Kubernetes service deploying in default namespace instead of defined namespace using Helm

7/9/2019

I am trying to deploy my microservice on a Kuberenetes cluster in 2 different environment dev and test. And I am using helm chart to deploy my Kubernetes service. I am using Jenkinsfile to deploy the chart. And inside Jenkinsfile I added helm command within the stage like the following ,

stage ('helmchartinstall')
                {
                    steps
                    {
                        sh 'helm upgrade --install kubekubedeploy --namespace test pipeline/spacestudychart'
                    }
                }
             }

Here I am defining the --namespace test parameter. But when it deploying, it showing the console output with default namespace. I already created namespaces test and prod.

When I checked the Helm version, I got response like the following,

docker@mildevdcr01:~$ helm version
Client: &version.Version{SemVer:"v2.14.1", 
GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.0", 
GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}

Have I made any mistake here for defining the namespace?

-- Jacob
environment
kubernetes
kubernetes-helm

2 Answers

7/26/2019

Approach 1:

export TILLER_NAMESPACE= your_namespace
helm upgrade -i -n release_name chart.tgz

Approach 2:

helm upgrade -i -n release_name --namespace your_namespace chart.tgz
-- Manikanta P
Source: StackOverflow

7/20/2019

The most likely issue here is that the Chart already specifies default as metadata.namespace which in Helm 2 is not overwritten by the --namespace parameter.

If this is the cause a solution would be to remove the namespace specified in the metadata.namespace or to make it a template parameter (aka release value).

Also see https://stackoverflow.com/a/51137448/1977182.

-- B M
Source: StackOverflow