<p>Jenkins ver. 2.60.1 (running in container on kubernetes)</p>

<p>Kubernetes Plugin ver. 0.11 (<a href="https://github.com/jenkinsci/kubernetes-plugin" rel="nofollow noreferrer">https://github.com/jenkinsci/kubernetes-plugin</a>)</p>

<p>Pipeline test:</p>

<pre><code>podTemplate(
  label: 'mypod',
  volumes: [
    persistentVolumeClaim(claimName: 'nfs-maven', mountPath: '/mnt/', readOnly: false)],
    envVars: [
      containerEnvVar(key: 'FOO', value: 'BAR'),
    ],
  containers: [
    containerTemplate(name: 'golang',
    image: 'golang',

    ttyEnabled: true, 
    command: 'cat',

    )]
)
{
  node('mypod') {
    stage('test env') {

        container('golang') {
            stage('build') {
                sh 'echo $FOO'
                sh 'sleep 3600'
            }
        }
    }
  }
}
</code></pre>

<p>The vars are not passed into the containers. 
The echo echoes nothing. echo $FOO or echo \$FOO
I have tried on the pod level and container level.</p>

<p>When i describe the created pod i only get the following environment vars:</p>

<pre><code>Environment:                                                                                                                               
  JENKINS_LOCATION_URL:     http://ldn1-kube1:31000/                                                                                       
  JENKINS_SECRET:           107cb696a8792f998fd41b6ccacf833ea74941fc9a95c39c4b2a1cde4c008b35                                               
  JENKINS_JNLP_URL:         http://10.233.60.248:8080/computer/kubernetes-57beb710bfb44cea8f964d63049b2942-355760c790d6b/slave-agent.jnlp  
  JENKINS_TUNNEL:           10.233.60.248:50000                                                                                            
  JENKINS_NAME:             kubernetes-57beb710bfb44cea8f964d63049b2942-355760c790d6b                                                      
  JENKINS_URL:              http://10.233.60.248:8080                                                                                      
  HOME:                     /home/jenkins                                                                                                  
</code></pre>

<p>Upgrading the kubernetes-plugin to 0.12 (29/07/2017) and restarting jenkins has fixed the issue!</p>
