Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes permission denied error on config.lock

Tags:

kubernetes

I try to change default context in kubernetes but I get config.lock: permission denied error.

$ kubectl config set-context $(kubectl config current-context) --namespace=custom_namespace 
error: open /home/vagrant/.kube/config.lock: permission denied
like image 233
Lukasz Dynowski Avatar asked Dec 11 '18 15:12

Lukasz Dynowski


Video Answer


1 Answers

Make sure that kubernetes config directory has the same permissions as kubernetes config file.

Solution Beside, steps specified in kubernetes documentation.

$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

Add change permissions on $HOME/.kube/ directory.

$ sudo chown $(id -u):$(id -g) $HOME/.kube/
like image 71
Lukasz Dynowski Avatar answered Sep 18 '22 09:09

Lukasz Dynowski