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
.
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
It happened to be a problem with kubectl
. Reinstalling it solved this strange issue.
If you, like me, have stuck with strange gcloud
behavior, following points could help to track an issue:
alias
command and if it's really pointing to the intended binary;gsutil
and feed it your config files. If the gcloud container clusters get-credentials ...
runs smoothly there, than it's the problem with binaries (not configuration):docker run -it \
-v $HOME/.config:/root/.config \
-v $HOME/.kube:/root/.kube google/cloud-sdk:217.0.0-alpine sh
apt-get remove ...
, but apt-get purge ...
. Be aware: purge
removes config files!Hope this would help somebody else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With