helm install error

Helm unable to deploy application to any Kubernetes on specified namespaces

This tutorial guides you how to solve Error: release ams failed: namespaces “ams” is forbidden: User “system:serviceaccount:kube-system:default” cannot get resource “namespaces” in API group “” in the namespace “ams” while running helm command.

Helm deployment namespaces error

Are you facing the following error while using helm to deploy the application to any kubernetes cluster

$ helm install --namespace ams --name ams --set fullNameOverride=ams \
>   deployment/helm/social-network
Error: release ams failed: namespaces "ams" is forbidden: User "system:serviceaccount:kube-system:default" cannot get resource "namespaces" in API group "" in the namespace "ams"

helm install error

Solution:

If you are getting the above error while running helm install command, it might be because of not having permissions to deploy tiller. Therefore you need to add account using the below mentioned commands.

$ kubectl --namespace kube-system create serviceaccount tiller

from server (AlreadyExists): serviceaccounts "tiller" already exists
$ kubectl create clusterrolebinding tiller-cluster-rule \
--clusterrole=cluster-admin --serviceaccount=kube-system:tiller

clusterrolebinding.rbac.authorization.k8s.io/tiller-cluster-rule created
$ kubectl --namespace kube-system patch deploy tiller-deploy \
  -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

deployment.extensions/tiller-deploy patched
$ helm repo update

Then try running helm deployment commands like below, it should work now.

$ helm install --namespace ams --name ams --set fullNameOverride=ams \
  deployment/helm/ams

NAME:   ams
LAST DEPLOYED: Tue Feb 18 17:10:17 2020
NAMESPACE: ams
STATUS: DEPLOYED

RESOURCES:
==> v1/ClusterRole
NAME                                AGE
ams-grafana-clusterrole  5s
--------------------
---------------------------
---------------------------

Hope this suggestion helped !!

Also See

References

Leave a Reply

avatar
  Subscribe  
Notify of