Search code examples
kuberneteskubernetes-helmminikube

Helm 'Error: error installing: namespaces "{username}" not found'


I'm using Minikube to tinker with Helm.

I understand Helm installs tiller in the kube-system namespace by default:

The easiest way to install tiller into the cluster is simply to run helm init... Once it connects, it will install tiller into the kube-system namespace.

But instead it's trying to install tiller in a namespace named after me:

$ ~/bin/minikube start
* minikube v1.4.0 on Ubuntu 18.04
* Tip: Use 'minikube start -p ' to create a new cluster, or 'minikube delete' to delete this one.
* Starting existing virtualbox VM for "minikube" ...
* Waiting for the host to be provisioned ...
* Preparing Kubernetes v1.16.0 on Docker 18.09.9 ...
* Relaunching Kubernetes using kubeadm ...
* Waiting for: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"
$ helm init
$HELM_HOME has been configured at /home/mcrenshaw/.helm.
Error: error installing: namespaces "mcrenshaw" not found
$

I can specify the tiller namespace, but then I have to specify it in every subsequent use of helm.

$ helm init --tiller-namespace=kube-system
$HELM_HOME has been configured at /home/mcrenshaw/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
$ helm upgrade --install some-thing .
Error: could not find tiller
$ helm upgrade --install some-thing . --tiller-namespace=kube-system
Release "some-thing" does not exist. Installing it now.

I suppose specifying the namespace in each command is fine. But it feels incorrect. Have I done something to corrupt my Helm config?

Update:

Per Eduardo's request, here's my helm version:

$ helm version --tiller-namespace=kube-system
Client: &version.Version{SemVer:"v2.15.0", GitCommit:"c2440264ca6c078a06e088a838b0476d2fc14750", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.15.0", GitCommit:"c2440264ca6c078a06e088a838b0476d2fc14750", GitTreeState:"clean"}

Solution

  • There are two ways of setting the Tiller default namespace:

    1. Using the --tiller-namespace flag (as you are already using).
    2. By setting the $TILLER_NAMESPACE environment variable.

    The flag configuration takes precedence over the environment config. You probably have this environment variable set (you can check with printenv TILLER_NAMESPACE). If so, unset it and the further helm commands should point properly to kube-system namespace.