<p>I am now testing the deployment into different namespace using Kubernetes. Here I am using Kubernetes Helm Chart for that. In my chart, I have deployment.yaml and service.yaml.</p>

<p>When I am defining the "namespace" parameter with Helm command <code>helm install --upgrade</code>, it is not working. When I a read about that I found the statement that - "Helm 2 is not overwritten by the --namespace parameter".</p>

<p>I tried the following command:</p>

<pre><code>helm upgrade --install kubedeploy --namespace=test pipeline/spacestudychart 
</code></pre>

<p><strong>NB</strong> Here my service is deploying with <strong>default</strong> namespace.</p>

<p>Screenshot of describe pod:</p>

<p><a href="https://i.stack.imgur.com/UUv8a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UUv8a.png" alt="enter image description here"></a></p>

<p>Here my "helm version" command output is like follows:</p>

<pre><code>docker@mildevdcr01:~$ helm version
Client: &amp;version.Version{SemVer:"v2.14.3", 
GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Server: &amp;version.Version{SemVer:"v2.14.3", 
GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
</code></pre>

<p><strong>Because of this reason, I tried to addthis command in deployment.yaml</strong>, under metadata.namespace like following,</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "spacestudychart.fullname" . }}
  namespace: test
</code></pre>

<p>I created test and prod, 2 namespaces. But here also it's not working. When I adding like this, I am not getting my service up. I am not able to accessible. And in Jenkins console there is no error. When I defined in helm install --upgrade command it was deploying with default namespace. But here not deploying also.</p>

<p>After this, I removed the namespace from deployment.yaml and added metadata.namespace like the same. There also I am not able to access deployed service. But Jenkins console output still showing success.</p>

<p>Why namespace is not working with my Helm deployment? What changes I need to do here for deploying test/prod instead of this default namespace. </p>

Mr.DevEng
<p>Remove <code>namespace: test</code> from all of your chart files and <code>helm install --namespace=namespace2 ...</code> should work.</p>
