Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins kubernetes plugin running the pods in loop and job is never build

i am using jenkins kubernetes plugin.Configure it and testing a sample pipeline code as below:

podTemplate(containers: [
        containerTemplate(name: 'ssh-client', image: 'kroniak/ssh-client:3.6', ttyEnabled: true, command: 'cat')
]) {
    node(POD_LABEL) {
        stage('container log') {
            container('ssh-client') {
                sshagent (credentials: ['ContainerExecDecoratorPipelineTest-sshagent']) {
                    sh 'env'
                    sh 'ssh-add -L'
                    sh 'ssh -vT -o "StrictHostKeyChecking=no" [email protected]'
                }
            }
        }
    }
}

while this is building i can check my kubernetes cluster and noticed that pods are creating but terminating also after few seconds. It keeps happening infinitely. I even checked with all other sample pipelines. The console output in Jenkins shows :

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Created Pod: ns-jenkins/tests-14-zm889-hxd6p-j19bl
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Scheduled] Successfully assigned ns-jenkins/tests-14-zm889-hxd6p-j19bl to docker-desktop
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Pulling] Pulling image "kroniak/ssh-client:3.6"
Still waiting to schedule task
‘tests-14-zm889-hxd6p-j19bl’ is offline
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Pulled] Successfully pulled image "kroniak/ssh-client:3.6"
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Created] Created container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Started] Started container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Pulled] Container image "jenkins/inbound-agent:4.3-4" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Created] Created container jnlp
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Started] Started container jnlp
Created Pod: ns-jenkins/tests-14-zm889-hxd6p-23hwk
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Scheduled] Successfully assigned ns-jenkins/tests-14-zm889-hxd6p-23hwk to docker-desktop
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Pulled] Container image "kroniak/ssh-client:3.6" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Created] Created container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Started] Started container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Pulled] Container image "jenkins/inbound-agent:4.3-4" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Created] Created container jnlp
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Started] Started container jnlp
Created Pod: ns-jenkins/tests-14-zm889-hxd6p-wnxr9
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Scheduled] Successfully assigned ns-jenkins/tests-14-zm889-hxd6p-wnxr9 to docker-desktop
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Pulled] Container image "kroniak/ssh-client:3.6" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Created] Created container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Started] Started container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Pulled] Container image "jenkins/inbound-agent:4.3-4" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Created] Created container jnlp
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Started] Started container jnlp
like image 231
prem Avatar asked Jul 02 '20 20:07

prem


People also ask

Does Jenkins support Kubernetes plugin?

The Kubernetes plugin allocates Jenkins agents in Kubernetes pods. Within these pods, there is always one special container jnlp that is running the Jenkins agent. Other containers can run arbitrary processes of your choosing, and it is possible to run commands dynamically in any container in the agent pod.

What is Jnlp container in Jenkins?

The jnlp container takes care of the declarative checkout source code management (SCM) action. Unless otherwise specified, all other actions are executed in the Jenkins pipeline workspace.


1 Answers

kubectl logs <jenkins-pod> --namespace=<jenkins-namespace> is a good starting point to start debugging the issue.

When you define your Kubernetes clusters under Manage Jenkins -> Configure System -> Cloud -> Kubernetes Cloud Details, does the Jenkins URL match the Endpoint address in kubectl describe service jenkins?

The Endpoint address must match the Jenkins URL in the Kubernetes Cloud Details

kubectl describe service jenkins -n jenkins | grep Endpoint
Endpoints: 192.168.151.57:8080
like image 107
mandopaloooza Avatar answered Sep 28 '22 06:09

mandopaloooza