<p>We have a jenkins master-slave architecture and using the Kubernetes Jenkins plugin. The podTemplate looks as below</p>

<pre><code>podTemplate(label: 'builder-pod', cloud: 'kubernetes', containers: [
        containerTemplate(
                name: 'jnlp',
                image: "${artifact_repo}/jenkins-slave",
                ttyEnabled: true,
                privileged: false,
                alwaysPullImage: false,
                workingDir: '/var/jenkins_home',
                resourceRequestCpu: '1000m',
                resourceRequestMemory: '1Gi',
                resourceLimitMemory: '1.1Gi',
        )
], volumes: [hostPathVolume(mountPath: '/var/run', hostPath: '/var/run')], namespace: 'jenkins') { //podtemplate
    node('builder-pod') {
        container('jnlp') {


</code></pre>

<p>For whatever reason the builder-pod is being created in <code>default</code> namespace instead of the <code>jenkins</code> namespace</p>

<p>Any idea what could be wrong? 
Thanks in advance. </p>

smk
<p>You could always force the namespace by including that in your container definition:</p>

<pre><code>containerTemplate(
                name: 'jnlp',
                namespace: 'jenkins',
                image: "${artifact_repo}/jenkins-slave",
                ttyEnabled: true,
                privileged: false,
                alwaysPullImage: false,
                workingDir: '/var/jenkins_home',
                resourceRequestCpu: '1000m',
                resourceRequestMemory: '1Gi',
                resourceLimitMemory: '1.1Gi',
        )
</code></pre>

<p>As to why it isn't being loaded into the proper namespace, do you have a default kubernetes plugin config setup anywhere? There are settings for both the general namespace target and individual container template namespace targets. If you have neither, the above solution to set the namespace value may be the only way</p>
