Search code examples
gcloudkubectl

gcloud command changes ownership of the current directory


I'm performing usual operation of fetching kubernetes cluster credentials from GCP. The gcloud command doesn't fetch the credentials and surprisingly updates the ownership of the local directory:

~/tmp/1> ls
~/tmp/1> gcloud container clusters get-credentials production-ng
Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials) Unable to write file [/home/vladimir/tmp/1]: [Errno 21] Is a directory: '/home/vladimir/tmp/1'

~/tmp/1> ls
ls: cannot open directory '.': Permission denied

Other commands, like gcloud container clusters list work fine. I've tried to reinstall the gcloud.


Solution

  • This happens if your KUBECONFIG has an empty entry, like :/Users/acme/.kube/config gcloud resolves the empty value as the current directory, changes permissions and tries to write to it

    Reported at https://issuetracker.google.com/issues/143911217