Getting kubectl config use-context error when trying to switch context

二次信任 提交于 2021-01-28 19:22:42

问题


When I am trying to switch kubectl configuration using "kubectl config use-context new-context" where new-context is my desired context, I am getting the following error on my Mac machine:

error: open some-context.lock: file exists

where some-context is another kubectl configuration. However, some-context is not the active context. I see the same error when try "kubectl config set-context new-context" as well.

How can I fix the issue? I am using MacOS Mojava, version: 10.14.6.


回答1:


The issue was with my KUBECONFIG environment variable. It had duplicate entries for some-context . After removing the duplicate entry, it works as expected.



来源:https://stackoverflow.com/questions/58985141/getting-kubectl-config-use-context-error-when-trying-to-switch-context

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!