Cannot create clusterrolebinding on fresh GKE cluster

拟墨画扇 提交于 2019-12-22 11:28:08

问题


I provisioned a managed GKE cluster (Kubernetes version 1.9.4-gke.1) with basic authentication disabled. When i try to create RBAC configuration (for running my ingress controller) I get a following error: Error from server (Forbidden): clusterrolebindings.rbac.authorization.k8s.io is forbidden: User "XXX@gmail.com" cannot create clusterrolebindings.rbac.authorization.k8s.io at the cluster scope: Required "container.clusterRoleBindings.create" permission.

I found two related questions:

  1. GKE clusterrolebinding for cluster-admin fails with permission error
  2. User "xxx" cannot create clusterrolebindings.rbac.authorization.k8s.io at the cluster scope

First one contains a solution when basic authentication is enabled for the cluster which is not my case. And second question does not have an answer.

My user is not owner of the GCP project but it has editor role in the project. I found that this behavior was observed by others.

Please, advise how can I add the missing permission or otherwise defined RBAC on the GKE cluster when the cluster has basic authentication disabled.


回答1:


To create that ClusterRoleBinding, the caller must have container.clusterRoleBindings.create permission through GCP IAM. Only the OWNER and Kubernetes Admin IAM Roles contain that permission (because it allows modification of access control on your GKE clusters).

So, to allow person@company.com to run that command, they must be granted one of those roles. I'd recommend the Kubernetes Admin role.:

gcloud projects add-iam-policy-binding $PROJECT --member=user:person@company.com --role=roles/container.admin


来源:https://stackoverflow.com/questions/49770624/cannot-create-clusterrolebinding-on-fresh-gke-cluster

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!