Key takeaway
- Set up Jenkins on Kubernetes with persistent storage, a NodePort service and Helm. Checked against Jenkins and Kubernetes docs, with security advice.
How do you run Jenkins on Kubernetes?
Run Jenkins as a Deployment with persistent storage, expose it through a Service, read the initial admin password from the pod, and finish setup in the browser. The Jenkins project documents two routes for this, plain manifests applied with kubectl and the official Helm chart. According to its site, the image is jenkins/jenkins:lts, the web interface listens on port 8080 and port 50000 is declared for agent connections (jenkins.io, Installing Jenkins on Kubernetes).
A common mistake in tutorials is storing /var/jenkins_home on an emptyDir volume. Kubernetes deletes that data permanently when the pod is removed from a node, so a reschedule wipes your jobs and credentials. This guide uses a PersistentVolumeClaim instead. For the cluster concepts behind it, see our guide to Kubernetes architecture and components.
What do you need before you start?
- A Kubernetes cluster you can reach with
kubectl. A local minikube cluster is fine for a trial. - A default StorageClass, or a PersistentVolume you create yourself, so the Jenkins home directory survives pod restarts.
- Helm 3 only if you choose the Helm route.
- A firewall or network policy plan. Minikube's
nonedriver runs Kubernetes on the host itself and, according to the minikube documentation, containers may then have full access to the host filesystem, so avoid it on shared machines (minikube none driver).
Which way should you install Jenkins on Kubernetes?
| Route | When it fits | Current status and source |
|---|---|---|
| Plain manifests with kubectl | Learning, small teams, full control of every object | Documented by Jenkins with a namespace, service account, volume, deployment and service (jenkins.io). |
Helm chart (jenkinsci / jenkins repo) | Repeatable installs, values files in Git, easier upgrades | The chart repository is https://charts.jenkins.io, and its default charts target Jenkins LTS releases (charts.jenkins.io). Our Helm guide covers the package manager itself. |
| Kubernetes plugin for build agents | Running each build in a short-lived pod | The plugin runs dynamic agents in a Kubernetes cluster and creates a pod for each agent started, stopping it after each build. Check the plugin page for the current version and minimum Jenkins version (plugins.jenkins.io). |
How do you deploy Jenkins on Kubernetes step by step?
The steps below follow the manifest route. Treat the YAML as a starting point and pin an exact image tag for real use, because Jenkins advises pinning a version for predictable updates.

Step 1: Create the namespace, volume claim and deployment
Create a namespace with kubectl create namespace devops-tools. Then save the following as jenkins.yaml.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jenkins-pvc
namespace: devops-tools
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jenkins
namespace: devops-tools
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: jenkins
template:
metadata:
labels:
app: jenkins
spec:
containers:
- name: jenkins
image: jenkins/jenkins:lts
ports:
- containerPort: 8080
- containerPort: 50000
volumeMounts:
- name: jenkins-home
mountPath: /var/jenkins_home
volumes:
- name: jenkins-home
persistentVolumeClaim:
claimName: jenkins-pvc
Apply it with kubectl apply -f jenkins.yaml. This example runs one replica against one home directory. The Recreate strategy stops the old pod before starting the new one, so expect a short outage on each update.
Step 2: Create the service
A Deployment is not reachable from outside the cluster until a Service exposes it. Save this as jenkins-svc.yaml and apply it with kubectl apply -f jenkins-svc.yaml.
apiVersion: v1
kind: Service
metadata:
name: jenkins-service
namespace: devops-tools
spec:
type: NodePort
selector:
app: jenkins
ports:
- name: http
port: 8080
targetPort: 8080
nodePort: 30002
According to the Kubernetes documentation, a NodePort service uses a port from the range set by --service-node-port-range, 30000 to 32767 by default, and each node proxies that same port to the Service. If you set nodePort yourself, it must fall inside that range and you must avoid collisions (Kubernetes Service documentation). Check the result with kubectl get pods,svc -n devops-tools.
Step 3: Read the admin password and open Jenkins
Jenkins writes an initial admin password at /var/jenkins_home/secrets/initialAdminPassword, and it is also printed near the end of the pod log. Read it with kubectl logs deployment/jenkins -n devops-tools, or print the file with kubectl exec -n devops-tools deployment/jenkins -- cat /var/jenkins_home/secrets/initialAdminPassword.
Find a node address with minikube ip (or the address of any node in a real cluster) and browse to http://<node-ip>:30002. Paste the password, install the suggested plugins, and create your own admin user rather than staying on the default account. The Jenkins dashboard is now ready for CI/CD jobs.
Helm alternative
With Helm 3, add the repository with helm repo add jenkins https://charts.jenkins.io and helm repo update, then install with a values file. The Jenkins documentation installs the jenkinsci/jenkins chart with a values file that sets the NodePort, storage class and service account, and reads the generated admin password from the jenkins secret instead of the pod log. Keep the values file in Git so the setup is reviewable.
Why is emptyDir the wrong volume for Jenkins?
| Volume | What happens to Jenkins data | Use it for |
|---|---|---|
emptyDir | Created when the pod is assigned to a node. Safe across container crashes, but deleted permanently when the pod is removed from the node for any reason, as the Kubernetes volumes page states. | Scratch space and caches only. |
| PersistentVolumeClaim | Data outlives the pod, subject to the storage class and where the volume lives. | Jenkins home in any shared or long-lived environment. |
hostPath or local volume | Jenkins calls these suitable only for development and testing. A local volume loses data if the node is deleted. | Minikube trials. |
Source: Kubernetes Volumes and jenkins.io. Whatever you choose, back up the Jenkins home and test a restore.
What changes when you run Jenkins in production on Kubernetes?
A trial cluster and a platform that serves many teams differ in four ways that matter to a CTO or platform lead.
- Security: Jenkins holds credentials and can deploy to your clusters. Restrict its service account with RBAC, put the interface behind TLS and single sign-on, and keep port 50000 closed unless agents connect inbound. Our DevSecOps in CI/CD guide, application security checklist and Kubernetes security tools overview cover the controls.
- Upgrades: Pin the image tag and test plugin compatibility first. A floating tag with
imagePullPolicy: Alwayscan upgrade Jenkins unexpectedly on a pod restart. - Cost: A controller that is always on, plus its volume, is a fixed cost. Agents created per build by the Kubernetes plugin spend compute only while builds run.
- Delivery discipline: A pipeline server is only as good as its practices. Use our DevOps checklist to review pipeline, testing and release controls.
When should you not run Jenkins on Kubernetes?
Skip it when one small team runs a handful of jobs and nobody owns the cluster: a managed CI service or a single virtual machine is simpler to operate. Be careful if the pipeline needs privileged Docker builds, because the official image does not include the Docker CLI and daemon access inside pods widens your attack surface. Rootless or daemonless image builds are worth evaluating first.
What is a sensible adoption sequence?
- Trial the manifests on a local cluster and learn where Jenkins keeps its state.
- Move to the Helm chart with a values file in Git and a pinned image tag.
- Add the Kubernetes plugin so builds run in short-lived agent pods.
- Harden access: RBAC, TLS, single sign-on, secrets management and backups.
- Decide which delivery decisions, such as release approvals, should stay with people and which agents may take under policy.
For that last step, ElixirClaw is an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control, and ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents.
To map one pipeline decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
Can I run Jenkins on Kubernetes without losing data?
Yes, if Jenkins home is on a PersistentVolumeClaim. An emptyDir volume is deleted permanently when the pod is removed from a node, so it is only suitable for a throwaway trial.
Which image should I use for Jenkins on Kubernetes?
The Jenkins documentation uses jenkins/jenkins:lts and recommends pinning a specific version for predictable updates.
Which ports does Jenkins use in the cluster?
Port 8080 serves the web interface. Port 50000 is declared for agent connections and can stay closed if agents do not connect inbound.
What NodePort range can I use?
By default Kubernetes allocates NodePorts from 30000 to 32767, and a port you choose yourself must fall inside the configured range.
Should I use Helm or plain manifests?
Manifests help you learn what each object does. The official Helm chart suits repeatable installs and upgrades, with the values file kept in Git.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE