[英]Can't deploy to GKE by a specific linux user
We have a Jenkins virtual machine on GCE which deals with deployments, including the ones we do to GKE.我们在 GCE 上有一个 Jenkins 虚拟机,用于处理部署,包括我们对 GKE 所做的部署。 We've tried to deploy a project which we have not touched for some time.
我们试图部署一个我们有一段时间没有接触过的项目。 The deployment failed when calling
调用时部署失败
kubectl set image deployment my-deployment my-deployment=gcr.io/my-project/my-project:version-tag
getting this error:收到此错误:
Error from server (Forbidden): deployments.extensions "my-deployment" is forbidden: User "client" cannot get resource "deployments" in API group "extensions" in the namespace "default"
The weird thing is, if I log in to the machine, use my Linux user + my gcloud user, I can deploy fine.奇怪的是,如果我登录机器,使用我的Linux用户+我的gcloud用户,我可以很好地部署。 But when switching to the jenkins user using
su - jenkins
and then authorizing gcloud with my user I get this same error that our deploy account gets.但是,当使用
su - jenkins
切换到 jenkins 用户,然后向我的用户授权 gcloud 时,我遇到了与部署帐户相同的错误。
Please advise how to fix.请指教如何修复。
It seems related to cluster RBAC configurations.它似乎与集群 RBAC 配置有关。 Did you enable the RBAC fo Google Groups ?
您是否为Google Groups启用了RBAC ? In this case you should follow the instructions in the documentation above or disable it.
在这种情况下,您应该按照上述文档中的说明进行操作或禁用它。
Otherwise, ss Raman Sailopal stated, you can try this:否则,ss Raman Sailopal 说,你可以试试这个:
kubectl config get-contexts
to retrieve your current contextkubectl config get-contexts
以检索您当前的上下文/home/Linux user/.kube/config
to /home/jenkins/.kube/config
/home/Linux user/.kube/config
复制到/home/jenkins/.kube/config
kubectl config get-contexts
and kubectl config set-context ...
kubectl config get-contexts
和kubectl config set-context ...
确保您使用相同kubectl config set-context ...
# Check to see if I can create deployments in any namespace
kubectl auth can-i create deployments
# Check to see if I can list deployments in my current namespace
kubectl auth can-i list deployments.extensions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.