<p>The Kubernetes POD running on the Jenkins Slave is getting restarted. It is just repeating, nothing else. Kubernetes cluster is running in AWS. Can someone help, what exactly happening here. I am running a simple pipeline which I found in GitHub (<a href="https://github.com/vivid-lukeloresch/test-pipeline" rel="nofollow noreferrer">https://github.com/vivid-lukeloresch/test-pipeline</a>).  Here are the console logs. Thanks for all help. </p>

<pre><code>Obtained Jenkinsfile from git https://github.com/vivid-lukeloresch/test-pipeline.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] readTrusted
Obtained build-pod.yaml from git https://github.com/vivid-lukeloresch/test-pipeline.git
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Created Pod: default/promo-app-gn5v8-w05qg
[Normal][default/promo-app-gn5v8-w05qg][Scheduled] Successfully assigned default/promo-app-gn5v8-w05qg to ip-192-168-9-82.ec2.internal
[Normal][default/promo-app-gn5v8-w05qg][Pulling] Pulling image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-w05qg][Pulled] Successfully pulled image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-w05qg][Created] Created container maven
[Normal][default/promo-app-gn5v8-w05qg][Started] Started container maven
[Normal][default/promo-app-gn5v8-w05qg][Pulling] Pulling image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-w05qg][Pulled] Successfully pulled image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-w05qg][Created] Created container docker
[Normal][default/promo-app-gn5v8-w05qg][Started] Started container docker
[Normal][default/promo-app-gn5v8-w05qg][Pulled] Container image "jenkins/jnlp-slave:4.0.1-1" already present on machine
[Normal][default/promo-app-gn5v8-w05qg][Created] Created container jnlp
[Normal][default/promo-app-gn5v8-w05qg][Started] Started container jnlp
Still waiting to schedule task
‘promo-app-gn5v8-w05qg’ is offline
Created Pod: default/promo-app-gn5v8-3527t
[Normal][default/promo-app-gn5v8-3527t][Scheduled] Successfully assigned default/promo-app-gn5v8-3527t to ip-192-168-81-238.ec2.internal
[Normal][default/promo-app-gn5v8-3527t][Pulling] Pulling image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-3527t][Pulled] Successfully pulled image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-3527t][Created] Created container maven
[Normal][default/promo-app-gn5v8-3527t][Started] Started container maven
[Normal][default/promo-app-gn5v8-3527t][Pulling] Pulling image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-3527t][Pulled] Successfully pulled image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-3527t][Created] Created container docker
[Normal][default/promo-app-gn5v8-3527t][Started] Started container docker
[Normal][default/promo-app-gn5v8-3527t][Pulled] Container image "jenkins/jnlp-slave:4.0.1-1" already present on machine
[Normal][default/promo-app-gn5v8-3527t][Created] Created container jnlp
[Normal][default/promo-app-gn5v8-3527t][Started] Started container jnlp
Created Pod: default/promo-app-gn5v8-hqr5z
[Normal][default/promo-app-gn5v8-hqr5z][Scheduled] Successfully assigned default/promo-app-gn5v8-hqr5z to ip-192-168-81-238.ec2.internal
[Normal][default/promo-app-gn5v8-hqr5z][Pulling] Pulling image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-hqr5z][Pulled] Successfully pulled image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-hqr5z][Created] Created container maven
[Normal][default/promo-app-gn5v8-hqr5z][Started] Started container maven
[Normal][default/promo-app-gn5v8-hqr5z][Pulling] Pulling image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-hqr5z][Pulled] Successfully pulled image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-hqr5z][Created] Created container docker
[Normal][default/promo-app-gn5v8-hqr5z][Started] Started container docker
[Normal][default/promo-app-gn5v8-hqr5z][Pulled] Container image "jenkins/jnlp-slave:4.0.1-1" already present on machine
[Normal][default/promo-app-gn5v8-hqr5z][Created] Created container jnlp
[Normal][default/promo-app-gn5v8-hqr5z][Started] Started container jnlp
Created Pod: default/promo-app-gn5v8-7zn32
[Normal][default/promo-app-gn5v8-7zn32][Scheduled] Successfully assigned default/promo-app-gn5v8-7zn32 to ip-192-168-9-82.ec2.internal
[Normal][default/promo-app-gn5v8-7zn32][Pulling] Pulling image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-7zn32][Pulled] Successfully pulled image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-7zn32][Created] Created container maven
[Normal][default/promo-app-gn5v8-7zn32][Started] Started container maven
[Normal][default/promo-app-gn5v8-7zn32][Pulling] Pulling image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-7zn32][Pulled] Successfully pulled image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-7zn32][Created] Created container docker
[Normal][default/promo-app-gn5v8-7zn32][Started] Started container docker
[Normal][default/promo-app-gn5v8-7zn32][Pulled] Container image "jenkins/jnlp-slave:4.0.1-1" already present on machine
[Normal][default/promo-app-gn5v8-7zn32][Created] Created container jnlp
[Normal][default/promo-app-gn5v8-7zn32][Started] Started container jnlp
Created Pod: default/promo-app-gn5v8-jsgzn
[Normal][default/promo-app-gn5v8-jsgzn][Scheduled] Successfully assigned default/promo-app-gn5v8-jsgzn to ip-192-168-9-82.ec2.internal
[Normal][default/promo-app-gn5v8-jsgzn][Pulling] Pulling image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-jsgzn][Pulled] Successfully pulled image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-jsgzn][Created] Created container maven
[Normal][default/promo-app-gn5v8-jsgzn][Started] Started container maven
[Normal][default/promo-app-gn5v8-jsgzn][Pulling] Pulling image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-jsgzn][Pulled] Successfully pulled image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-jsgzn][Created] Created container docker
[Normal][default/promo-app-gn5v8-jsgzn][Started] Started container docker
[Normal][default/promo-app-gn5v8-jsgzn][Pulled] Container image "jenkins/jnlp-slave:4.0.1-1" already present on machine
[Normal][default/promo-app-gn5v8-jsgzn][Created] Created container jnlp
[Normal][default/promo-app-gn5v8-jsgzn][Started] Started container jnlp
Created Pod: default/promo-app-gn5v8-zskvd
[Normal][default/promo-app-gn5v8-zskvd][Scheduled] Successfully assigned default/promo-app-gn5v8-zskvd to ip-192-168-81-238.ec2.internal
[Normal][default/promo-app-gn5v8-zskvd][Pulling] Pulling image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-zskvd][Pulled] Successfully pulled image "maven:3.5.4-jdk-8-slim"
[Normal][default/promo-app-gn5v8-zskvd][Created] Created container maven
[Normal][default/promo-app-gn5v8-zskvd][Started] Started container maven
[Normal][default/promo-app-gn5v8-zskvd][Pulling] Pulling image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-zskvd][Pulled] Successfully pulled image "docker:18.06.1"
[Normal][default/promo-app-gn5v8-zskvd][Created] Created container docker
[Normal][default/promo-app-gn5v8-zskvd][Started] Started container docker
[Normal][default/promo-app-gn5v8-zskvd][Pulled] Container image "jenkins/jnlp-slave:4.0.1-1" already present on machine
[Normal][default/promo-app-gn5v8-zskvd][Created] Created container jnlp
[Normal][default/promo-app-gn5v8-zskvd][Started] Started container jnlp
</code></pre>

<p>Looks like the Jenkins slave can't initialize. Most likely because it can't connect to the Jenkins master.</p>

<p>Make sure your slave/pod can connect to the value of <code>JENKINS_URL</code>.  You can start another pod on the same namespace and see if you have any connectivity issues:</p>

<pre><code>$ kubectl run -i --tty --rm debug --image=ubuntu --restart=Never -n &lt;namespace-where-the-jenkins-pods-are-running&gt; -- sh
</code></pre>

<p>You can also look at the logs while the pod is running for the specific containers.</p>

<pre><code>$ kubectl -n &lt;namespace-where-the-jenkins-pods-are-running&gt; logs -c &lt;container-name&gt; &lt;pod-name&gt;
</code></pre>

<p>For example:</p>

<pre><code>$ kubectl -n default logs -c jnlp promo-app-gn5v8-w05qg
</code></pre>
