问题
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