Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 799
Mr.DevEng Avatar asked Jul 09 '19 14:07

Mr.DevEng


People also ask

How do I change namespace in Helm?

Step 1: create the following folder. Where helm and helmfile are the binary executables. Step 2: install the helm diff plugin which is needed used by helmfile. Step 3: declare your charts in the helmfile.

What is Kubernetes service in default namespace?

AFAIK the kubernetes service in the default namespace is a service which forwards requests to the Kubernetes master ( Typically kubernetes API server). Lets checkout the output of kubectl describe svc kubernetes and look at the the Endpoint IP.

How do I change the default namespace in Kubernetes?

Setting Default Namespace Namespace defaults are set in your cluster's context configuration. We change the default you will need to use the kubectl set-config command and specify the name of the namespace want to be used as default.

Can a Helm chart create a namespace?

With its November 2019 release, Helm 3 works great as a package manager that creates repeatable builds of Kubernetes applications. However, there's one exception: Helm no longer creates namespaces for your deployments.


1 Answers

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.

like image 153
B M Avatar answered Oct 16 '22 18:10

B M