简体   繁体   中英

Why gcloud container clusters get-credentials messes up my Linux user permissions?

After the notification from google about deprecation of previous auth mechanism for Kubernetes client that looked like that:

We're writing to remind you that, starting with Kubernetes v1.25, you must install a new binary called gke-gcloud-auth-plugin along with Kubectl (and custom Kubernetes clients) for continued access to GKE Clusters. You may do this any time, starting now, and we advise you to do this before you start using clients built with v1.25 or greater, which is expected to be released in Q3 2022.

I have followed the new instruction for installing and configuring authentication with a plugin: https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_plugin

But after the command gcloud container clusters get-credentials $mycluster I received the following error: ERROR: (gcloud.container.clusters.get-credentials) Unable to write file [/home/wls]: [Errno 21] Is a directory: '/home/wls' And now my system user is messed up and I do not have permissions for my own home directory:

ls -l /home/wls 
ls: cannot access '/home/wls/Templates': Permission denied
ls: cannot access '/home/wls/Pictures': Permission denied
ls: cannot access '/home/wls/todo': Permission denied
ls: cannot access '/home/wls/Scripts': Permission denied
ls: cannot access '/home/wls/Desktop': Permission denied
ls: cannot access '/home/wls/Downloads': Permission denied
ls: cannot access '/home/wls/Resources': Permission denied
ls: cannot access '/home/wls/Programs': Permission denied
ls: cannot access '/home/wls/Old': Permission denied
ls: cannot access '/home/wls/Documents': Permission denied
ls: cannot access '/home/wls/snap': Permission denied
ls: cannot access '/home/wls/Music': Permission denied
ls: cannot access '/home/wls/Public': Permission denied
ls: cannot access '/home/wls/Videos': Permission denied
ls: cannot access '/home/wls/Projects': Permission denied
total 0
d????????? ? ? ? ?              ? Desktop
d????????? ? ? ? ?              ? Documents
d????????? ? ? ? ?              ? Downloads
d????????? ? ? ? ?              ? Music
d????????? ? ? ? ?              ? Old
d????????? ? ? ? ?              ? Pictures
d????????? ? ? ? ?              ? Programs
d????????? ? ? ? ?              ? Projects
d????????? ? ? ? ?              ? Public
d????????? ? ? ? ?              ? Resources
d????????? ? ? ? ?              ? Scripts
d????????? ? ? ? ?              ? snap
d????????? ? ? ? ?              ? Templates
-????????? ? ? ? ?              ? todo
d????????? ? ? ? ?              ? Videos

Did anybody face such an issue? For now, I don't know how to fix that because the permissions for files seems to be ok (if checking from root) but the user cannot access files anymore.

I have managed to figure out what's going on. I have a custom KUBECONFIG and it seems that in this case gcloud behave strangely (based on gcloud SDK: Unable to write file ) Once I have performed unset KUBECONFIG before executing get-credentials operation it has been completed successfully. Now I can just return back my previous value for KUBECONFIG variable and use the content of generated kubeconfig file (/home/wls/.kube/config) as I want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM