error: open $HOME/config.lock: file exists

Viewed 6118

I have a problem with switching context in a terminal and Docker desktop bar panel on Mac:

kubectl config use-context master-cluster
error: open /Users/sacherus/.kube/config.lock: file exists

ls -lh /Users/sacherus/.kube/config.lock
----------  1 sacherus  staff     0B Jun  9 00:01 

I think it could be: Pycharm's kubernetes plugin, Docker desktop bar panel or some plugin to zsh.

Of course, I can delete config.lock, but this file is being created every few hours.

1 Answers

Community wiki answer based on discussion from the comments

Most probably the root cause is duplicate entries in KUBECONFIG env.

To fix the problem export proper KUBECONFIG. This was also discussed here

Related