Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40623

A pod template is adding a new non-defined container

      I've defined multiple pod-templates in the Kubernetes-Plugin with only 1 container (the pod template definition is attached).
      When I run a new job from some pod-template (I tried with 2 different), the pod contains a non-defined container with an independent docker image and resources called jnlp.
      Here is the result when I describe the pod:

      Name:			base-49928037d9757
      Namespace:		jenkins
      Security Policy:	hostmount-anyuid
      Node:			nodename
      Start Time:		Thu, 22 Dec 2016 09:40:05 +0100
      Labels:			jenkins=slave
      			jenkins/base=true
      Status:			Running
      IP:			10.1.1.2
      Controllers:		<none>
      Containers:
        slave:
          Container ID:	docker://ab6c86f5c9900f4e1b0c19fe1dda21536d591048bcb4f124fe357d1cd2ccbd44
          Image:		myImage
          Image ID:		docker://sha256:66c32c2cc23742e0f860b4068127ab0365ce24fa21a9932b17c873bee0210725
          Port:		
          Command:
            /var/lib/jenkins/bin/jenkins-slave.sh
          Args:
            c161cc0981fa74e8ef64255824b21b61c23739824ba99a6aa843eafab85dadbd
            base-49928037d9757
          Limits:
            cpu:	1
            memory:	1Gi
          Requests:
            cpu:		1
            memory:		1Gi
          State:		Running
            Started:		Thu, 22 Dec 2016 09:40:09 +0100
          Ready:		True
          Restart Count:	0
          Volume Mounts:
            /opt/jenkins-slave from volume-0 (rw)
            /var/run/secrets/kubernetes.io/serviceaccount from default-token-0xn6i (ro)
          Environment Variables:
            JENKINS_SECRET:		c161cc0981fa74e8ef64255824b21b61c23739824ba99a6aa843eafab85dadbd
            JENKINS_NAME:		base-49928037d9757
            JENKINS_LOCATION_URL:	https://bcngpp1vsjenkins01.scytl.net/
            JENKINS_URL:		https://jenkins1.scytl.net
            JENKINS_JNLP_URL:		https://jenkins1.scytl.net/computer/base-49928037d9757/slave-agent.jnlp
            HOME:			/opt/jenkins-slave
        jnlp:
          Container ID:	docker://52bd0d42aebf344c813d13f4436d0f78750a9c8f58bff62eefb76e4d6dfb951f
          Image:		jenkinsci/jnlp-slave:alpine
          Image ID:		docker://sha256:254fd665eaf0229f38295a9eac6c7f9bf32a2f450ecbcc8212f3e53b96dd339d
          Port:		
          Args:
            c161cc0981fa74e8ef64255824b21b61c23739824ba99a6aa843eafab85dadbd
            base-49928037d9757
          Limits:
            cpu:	1
            memory:	1Gi
          Requests:
            cpu:		1
            memory:		1Gi
          State:		Running
            Started:		Thu, 22 Dec 2016 09:40:11 +0100
          Ready:		True
          Restart Count:	0
          Volume Mounts:
            /home/jenkins from workspace-volume (rw)
            /opt/jenkins-slave from volume-0 (rw)
            /var/run/secrets/kubernetes.io/serviceaccount from default-token-0xn6i (ro)
          Environment Variables:
            JENKINS_SECRET:		c161cc0981fa74e8ef64255824b21b61c23739824ba99a6aa843eafab85dadbd
            JENKINS_NAME:		base-49928037d9757
            JENKINS_LOCATION_URL:	jenkinsUrl
            JENKINS_URL:		jenkinsUrl
            JENKINS_JNLP_URL:		jenkinsUrl/computer/base-49928037d9757/slave-agent.jnlp
            HOME:			/home/jenkins
      Conditions:
        Type		Status
        Initialized 	True 
        Ready 	True 
        PodScheduled 	True 
      Volumes:
        volume-0:
          Type:	NFS (an NFS mount that lasts the lifetime of a pod)
          Server:	ipNfs
          Path:	/opt/jenkins-shared
          ReadOnly:	false
        workspace-volume:
          Type:	EmptyDir (a temporary directory that shares a pod's lifetime)
          Medium:	
        default-token-0xn6i:
          Type:	Secret (a volume populated by a Secret)
          SecretName:	default-token-0xn6i
      QoS Tier:	Guaranteed
      

      The entrypoint of the slave container (which I've defined) is using a bash based on csanchez bash script, and is connecting using Jenkins Remoting layer.

      How can you explain this new container called jnlp? It is consuming so much resources per each pod and decreasing my environment.
      I tried a downgrade of the Kubernetes-Plugin to 0.9 and it isn't happening.

          [JENKINS-40623] A pod template is adding a new non-defined container

          The jnlp container is needed and can be customized by creating a container with the same jnlp name
          https://github.com/jenkinsci/kubernetes-plugin#constraints

          Carlos Sanchez added a comment - The jnlp container is needed and can be customized by creating a container with the same jnlp name https://github.com/jenkinsci/kubernetes-plugin#constraints

          Albert V added a comment -

          But in 0.9 version, the jnlp container was not created in my own pod (the same definition as attached) and the entrypoint script connects perfectly to my jenkins instance.
          Anyway, I don't understand in which moment this is required and why? Indeed, if I have my own entrypoint that uses jnlp connection, I think that I should be able to disable this jnlp container.

          So, how can avoid it?

          Thank you csanchez

          Albert V added a comment - But in 0.9 version, the jnlp container was not created in my own pod (the same definition as attached) and the entrypoint script connects perfectly to my jenkins instance. Anyway, I don't understand in which moment this is required and why? Indeed, if I have my own entrypoint that uses jnlp connection, I think that I should be able to disable this jnlp container. So, how can avoid it? Thank you csanchez

          Carlos Sanchez added a comment - - edited

          just rename your slave container to jnlp and it won't owerwrite it

          Carlos Sanchez added a comment - - edited just rename your slave container to jnlp and it won't owerwrite it

          Albert V added a comment -

          this solved it! Thank you csanchez.
          Anyway, I think that this is not so much intuitive as expected. Maybe with some explanation near the field would help to others.

          Ty!

          Albert V added a comment - this solved it! Thank you csanchez . Anyway, I think that this is not so much intuitive as expected. Maybe with some explanation near the field would help to others. Ty!

            csanchez Carlos Sanchez
            m4x1m0v3r Albert V
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: