Step-by-Step Guide to Deploying Jenkins with ArgoCD on a Kubernetes Cluster
This guide walks through setting up a Kubernetes cluster with NFS storage, loading Jenkins and agent Docker images, configuring ArgoCD, deploying Jenkins via declarative manifests, initializing Jenkins, creating and deploying a static Jenkins agent, and troubleshooting common issues, providing full code snippets and screenshots.
This article, part of the 7th DevOps training camp, demonstrates how to build a practice environment based on Kubernetes (K8s) and ArgoCD. It assumes you have a K8s cluster with Ingress, persistent storage, and ArgoCD installed.
The tutorial uses Docker images jenkins/jenkins:2.415-jdk11 and jenkins/inbound-agent:latest . It shows how to pull these images and load them into a Kind cluster.
Step1 Image Configuration
Optionally download the images locally and load them into the Kind cluster:
## LoadDockerImage
kind load docker-image jenkins/jenkins:2.415-jdk11 --name devopscluster
kind load docker-image jenkins/inbound-agent:latest --name devopsclusterStep2 Deploy Jenkins
A set of Kubernetes manifests and a declarative Argo CD application are prepared. Apply the Argo CD application to install Jenkins:
kubectl -n argocd apply -f jenkins-argoapp.yamlStep3 Jenkins Initialization
Retrieve the unlock secret from the Jenkins pod logs via the Argo CD UI. During plugin installation, choose a custom setup and select no plugins to avoid network issues.
Step4 Create Agent
Add a new node in Jenkins, fill in the node details and configuration as shown in the screenshots, and obtain the secret key needed for the agent.
Step5 Deploy Agent
Apply the Argo CD application for the Jenkins agent:
kubectl -n argocd apply -f jenkins-agent-argoapp.yamlFAQ
If the agent logs show an "invalid X-Instance-Identity" error, install the "Instance Identity" plugin in Jenkins and restart the service. Example error output:
SEVERE: http://jenkins.jenkins.svc.cluster.local:8080/tcpSlaveAgentListener/ appears to be publishing an invalid X-Instance-Identity.
java.io.IOException: http://jenkins.jenkins.svc.cluster.local:8080/tcpSlaveAgentListener/ appears to be publishing an invalid X-Instance-Identity.
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:284)
at hudson.remoting.Engine.innerRun(Engine.java:724)
at hudson.remoting.Engine.run(Engine.java:540)For more details, refer to the Jenkins community discussion linked in the article. If any issues arise, submit an issue to the provided code repository.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.