Jenkins setup:
Jenkins: 2.426.3
OS: Linux - 5.15.0-91-generic
Java: 17.0.9 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
Running Jenkins on Kubernetes Cluster
Installed Jenkins using Helm Charts
Creating Agent/Pods using Kubernetes Plugin
Issue:
I’ve deployed Jenkins using Jenkins Official Helm Charts on Kubernetes cluster, and have configured Kubernetes plugin to launch pods for any job or build on Jenkins.
I have a private container registry i.e. Harbor where I downloaded the official inbound-agent image from Dockerhub and uploaded to Harbor.
Then changed the values.yaml file of Helm chart to reflect the entries
Snippet of values.yaml
agent:
enabled: true
defaultsProviderTemplate: ""
# URL for connecting to the Jenkins controller
jenkinsUrl:
# connect to the specified host and port, instead of connecting directly to the Jenkins controller
jenkinsTunnel:
kubernetesConnectTimeout: 5
kubernetesReadTimeout: 15
maxRequestsPerHostStr: "32"
retentionTimeout: 5
waitForPodSec: 600
namespace: jenkins-custom
# private registry for agent image
jnlpregistry: "172.x.x.x:30002"
image:
repository: "jenkins/inbount-agent"
tag: "v1.1"
workingDir: "/home/jenkins/agent"
nodeUsageMode: "NORMAL"
customJenkinsLabels: []
# name of the secret to be used for image pulling
imagePullSecretName: harborcred2
componentName: "jenkins-agent"
And, this JNLP configuration is correctly picked and shown in Jenkins controller under cloud providers section.
However, when I’m running the Jenkins build then it is not considering the given JNLP Image and Tag values and seems like picking some default JNLP configuration where getting below error in kubernetes pods.
Normal Pulled 15s kubelet Successfully pulled image "x.x.x.x:30002/jenkins-slave/jenkinsagent:v5" in 392.408547ms (392.418299ms including waiting)
Normal Created 15s kubelet Created container custom-agent
Normal Started 15s kubelet Started container custom-agent
Normal Pulling 15s kubelet Pulling image "x.x.x.x:30002/jenkins/kaniko-project-executor:1.22"
Normal Pulled 14s kubelet Successfully pulled image "x.x.x.x:30002/jenkins/kaniko-project-executor:1.22" in 411.890596ms (411.896051ms including waiting)
Normal Created 14s kubelet Created container kaniko
Normal Started 14s kubelet Started container kaniko
Normal Pulling 14s kubelet Pulling image "x.x.x.x:30002/jenkins/inbound-agent:3206.vb_15dcf73f6a_9-2"
Warning Failed 14s kubelet Failed to pull image "x.x.x.x:30002/jenkins/inbound-agent:3206.vb_15dcf73f6a_9-2": rpc error: code = Unknown desc = failed to pull and unpack image "x.x.x.x:30002/jenkins/inbound-agent:3206.vb_15dcf73f6a_9-2": failed to resolve reference "x.x.x.x:30002/jenkins/inbound-agent:3206.vb_15dcf73f6a_9-2": failed to do request: Head "https://172.29.66.98:30002/v2/jenkins/inbound-agent/manifests/3206.vb_15dcf73f6a_9-2": http: server gave HTTP response to HTTPS client
Warning Failed 14s kubelet Error: ErrImagePull
Normal BackOff 13s (x2 over 14s) kubelet Back-off pulling image "x.x.x.x:30002/jenkins/inbound-agent:3206.vb_15dcf73f6a_9-2"
I’m only getting error while pulling JNLP Image and not the rest of the images like Kaniko or custom-agent from Harbor. Not sure why this error is coming and already spent lot of time on this issue. Any help on this will be appreciated!!!
Thanks in advance