Wednesday, February 14, 2018

Error: release my-nginx failed: namespaces "default" is forbidden: User "system:serviceaccount:kube-system:default" cannot get namespaces in the namespace "default"

Reset the helm tiller:
helm reset --force
Create a RBAC yml file:
$ cat rbac-config.yml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system
Create Service Account and Role binding by running yaml file:
$ kubectl create -f rbac-config.yaml --v=4
serviceaccount "tiller" created
clusterrolebinding "tiller" created

Initialize a tiller:
$ helm init --service-account tiller
Official Reference:
https://github.com/kubernetes/helm/blob/master/docs/rbac.md

No comments:

Post a Comment