<p>I'm fairly new into Jenkins Kubernetes Plugin and Kubernetes in general - <a href="https://github.com/jenkinsci/kubernetes-plugin" rel="nofollow noreferrer">https://github.com/jenkinsci/kubernetes-plugin</a></p>

<p>I want to use the plugin for E2E tests setup inside my CI.</p>

<p>Inside my <code>Jenkinsfile</code> I have a <code>podTemplate</code> which looks and used as follows:</p>

<pre><code>def podTemplate = """
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: website
    image: ${WEBSITE_INTEGRATION_IMAGE_PATH}
    command:
      - cat
    tty: true
    ports:
     - containerPort: 3000
  - name: cypress
    resources:
      requests:
        memory: 2Gi
      limit:
        memory: 4Gi
    image: ${CYPRESS_IMAGE_PATH}
    command:
      - cat
    tty: true
"""

pipeline {
  agent {
    label 'docker'
  }
  stages {
    stage('Prepare') {
      steps {
        timeout(time: 15) {
          script {
            ci_machine = docker.build("${WEBSITE_IMAGE_PATH}")
          }
        }
      }
    }

    stage('Build') {
      steps {
        timeout(time: 15) {
          script {
            ci_machine.inside("-u root") {
              sh "yarn build"
            }
          }
        }
      }

      post {
        success {
          timeout(time: 15) {
            script {
              docker.withRegistry("https://${REGISTRY}", REGISTRY_CREDENTIALS) {
                integrationImage = docker.build("${WEBSITE_INTEGRATION_IMAGE_PATH}")
                integrationImage.push()
              }
            }
          }
        }
      }
    }

    stage('Browser Tests') {
      agent {
        kubernetes {
          label "${KUBERNETES_LABEL}"
          yaml podTemplate
        }
      }
      steps {
        timeout(time: 5, unit: 'MINUTES') {
          container("website") {
            sh "yarn start"
          }

          container("cypress") {
            sh "yarn test:e2e"
          }
        }
      }
  }
}


</code></pre>

<p>In <code>Dockerfile</code> that builds an image I added an <code>ENTRYPOINT</code></p>

<pre><code>ENTRYPOINT ["bash", "./docker-entrypoint.sh"]
</code></pre>

<p>However it seems that it's not executed by the kubernetes plugin.</p>

<p>Am I missing something?</p>

<p>As per <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod" rel="nofollow noreferrer">Define a Command and Arguments for a Container</a> docs:</p>

<blockquote>
  <p>The command and arguments that you define in the configuration file
  override the default command and arguments provided by the container
  image.</p>
</blockquote>

<p><a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes" rel="nofollow noreferrer">This</a> table summarizes the field names used by Docker and Kubernetes:</p>

<pre><code>| Docker field name | K8s field name |
|------------------:|:--------------:|
|    ENTRYPOINT     |     command    |
|       CMD         |      args      |
</code></pre>

<p>Defining a <code>command</code> implies ignoring your Dockerfile <code>ENTRYPOINT</code>:</p>

<blockquote>
  <p>When you override the default <code>ENTRYPOINT</code> and <code>CMD</code>, these rules apply:</p>
  
  <ul>
  <li>If you supply a <code>command</code> but no <code>args</code> for a Container, only the supplied <code>command</code> is used. The default <code>ENTRYPOINT</code> and the default <code>CMD</code> defined in the Docker image are ignored.</li>
  <li>If you supply only <code>args</code> for a Container, the default <code>ENTRYPOINT</code>
  defined in the Docker image is run with the <code>args</code> that you supplied.</li>
  </ul>
</blockquote>

<p>So you need to replace the <code>command</code> in your pod template by <code>args</code>,  which will preserve your Dockerfile <code>ENTRYPOINT</code> (acting equivalent to a Dockerfile <code>CMD</code>).</p>
