A Jenkins plugin that dynamically provisions and manages build agents as Kubernetes Pods to enable scalable CI/CD pipelines in Kubernetes or Docker environments.
Jenkins plugin to run dynamic agents in a Kubernetes/Docker environment
This tool is used by DevOps and SecOps teams to automate the scaling and management of Jenkins build agents within Kubernetes clusters, enabling efficient resource usage and seamless integration of containerized workloads. It is ideal for organizations leveraging Kubernetes for CI/CD pipelines who want dynamic, on-demand Jenkins agents that spin up and down per build.
Ensure the Kubernetes cluster version is 1.14 or higher and that the ServiceAccount used has sufficient privileges to create and manage pods. WebSocket mode is recommended when Jenkins controller is not directly accessible from agents, such as when behind reverse proxies or ingress resources. The plugin supports multiple authentication methods, so select the one that best fits your environment. It is not mandatory to run Jenkins controller inside Kubernetes, providing flexibility in deployment architectures.
Ensure a running Kubernetes cluster version 1.14 or later (OpenShift 4.x for OpenShift users)
Install a Jenkins instance
Install the Jenkins Kubernetes plugin via Jenkins Plugin Manager
Create a Kubernetes ServiceAccount with sufficient privileges (see example YAML)
Configure the plugin in Jenkins UI under Manage Jenkins -> Manage Nodes and Clouds -> Configure Clouds -> Add a new cloud -> Kubernetes
Enter Kubernetes URL and Jenkins URL (defaults work if Jenkins runs in Kubernetes)
Provide supported credentials (username/password, kubeconfig, token, Google Service Account, or X.509 certificate)
Optionally enable WebSocket mode for agent connections if Jenkins controller is external
Use the Test Connection button to verify communication between Jenkins and Kubernetes cluster
Navigate to Manage Jenkins -> Manage Nodes and Clouds -> Configure Clouds -> Add a new cloud -> Kubernetes
Access the Kubernetes plugin configuration interface in Jenkins UI to set up the Kubernetes cloud
Fill in Kubernetes URL and Jenkins URL fields
Specify the Kubernetes API endpoint and Jenkins web interface URL for agent communication
Select credentials type (e.g., kubeconfig, token, username/password)
Authenticate Jenkins to the Kubernetes cluster using supported credential methods
Check the WebSocket option
Enable agents to connect over HTTP(S) instead of TCP, useful when Jenkins controller is behind proxies or external
Click Test Connection
Verify Jenkins can successfully communicate with the Kubernetes cluster