Skip to content

Instantly share code, notes, and snippets.

@neumachen
Last active April 19, 2018 23:55
Show Gist options
  • Select an option

  • Save neumachen/ae112af20c96229d8cbf79183262de0a to your computer and use it in GitHub Desktop.

Select an option

Save neumachen/ae112af20c96229d8cbf79183262de0a to your computer and use it in GitHub Desktop.
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
# another fix
kubectl create clusterrolebinding --user system:serviceaccount:kube-system:default kube-system-cluster-admin --clusterrole cluster-admin
https://github.com/kubernetes/dashboard/issues/2326#issuecomment-326651713
# for fixing helm
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm init --service-account tiller --upgrade
https://stackoverflow.com/questions/46307325/gke-clusterrolebinding-for-cluster-admin-fails-with-permission-error
```
If your kubeconfig was created automatically by gcloud then your user is not the all powerful admin user - which you are trying to create a binding for.
Use gcloud container clusters describe <clustername> --zone <zone> on the cluster and look for the password field.
Thereafter execute kubectl --username=admin --password=FROMABOVE create clusterrolebinding ...
```
```
On https://codelabs.developers.google.com/codelabs/cloud-hello-istio/index.html?index=..%2F..%2Findex#2
$ kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \
--user=$(gcloud config get-value core/account)
Error from server (Forbidden): clusterrolebindings.rbac.authorization.k8s.io is forbidden: User "<snip>" cannot create clusterrolebindings.rbac.authorization.k8s.io at the cluster scope: Required "container.clusterRoleBindings.create" permission.
To get around this error, I had to add the username (admin) and related kubectl password.
$ kubectl --username=admin --password=<snip> create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \
--user=$(gcloud config get-value core/account)
clusterrolebinding "cluster-admin-binding" created
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment