codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
☸️

Kubernetes

29 / 82 topics
28Kubernetes in DevOps Pipelines29Using Jenkins with Kubernetes30GitOps in Kubernetes
Tutorials/Kubernetes/Using Jenkins with Kubernetes
☸️Kubernetes

Using Jenkins with Kubernetes

Updated 2026-05-15
10 min read

Using Jenkins with Kubernetes

Introduction

Jenkins is a widely-used open-source automation server that supports continuous integration (CI) and continuous delivery (CD). Integrating Jenkins with Kubernetes allows you to leverage the power of Kubernetes for managing your CI/CD pipelines, providing scalability, flexibility, and resource efficiency. In this tutorial, we will walk through setting up Jenkins on Kubernetes and configuring it to build and deploy applications.

Concept

Kubernetes is a container orchestration platform that automates deploying, scaling, and operating application containers. By integrating Jenkins with Kubernetes, you can run Jenkins agents as pods in your Kubernetes cluster. This setup allows Jenkins to scale dynamically based on the workload and utilize the full potential of Kubernetes for managing CI/CD tasks.

Examples

Step 1: Set Up a Kubernetes Cluster

Before setting up Jenkins, ensure you have a Kubernetes cluster running. You can use managed services like Google Kubernetes Engine (GKE), Amazon EKS, or Azure AKS, or set up your own using tools like Minikube for local development.

Terminal
Terminal
Terminal
Terminal

Open your web browser and navigate to the Jenkins URL. Log in using the admin password.

Step 5: Configure Jenkins for Kubernetes

  1. Install Kubernetes Plugin:

    • Go to "Manage Jenkins" > "Manage Plugins".
    • Search for "Kubernetes" and install it.
    • Restart Jenkins after installation.
  2. Configure Cloud:

    • Go to "Manage Jenkins" > "Configure System".
    • Scroll down to the "Cloud" section and click "Add a new cloud".
    • Select "Kubernetes".
    • Configure the Kubernetes URL (usually https://kubernetes.default.svc).
    • Set credentials if necessary.
    • Save the configuration.
  3. Create a Jenkinsfile:

    • In your application repository, create a Jenkinsfile.
    • Define stages for building and deploying your application.
groovy
1pipeline {
2 agent {
3 kubernetes {
4 label 'jenkins-slave'
5 yaml '''
6apiVersion: v1
7kind: Pod
8spec:
9containers:
10- name: maven
11 image: maven:3.8.4-jdk-11
12 command:
13 - cat
14 tty: true
15'''
16 }
17 }
18 stages {
19 stage('Build') {
20 steps {
21 container('maven') {
22 sh 'mvn clean install'
23 }
24 }
25 }
26 stage('Deploy') {
27 steps {
28 sh 'kubectl apply -f k8s/deployment.yaml'
29 }
30 }
31 }
32}
  1. Create a Jenkins Job:

    • Go to "New Item".
    • Enter a name for your job and select "Pipeline".
    • Configure the pipeline to use the Jenkinsfile from your repository.
    • Save the job.
  2. Run the Jenkins Job:

    • Click "Build Now" in your Jenkins job.
    • Monitor the build and deployment process.

What's Next?

After setting up Jenkins with Kubernetes, you can explore more advanced configurations like using Helm charts for deployments, integrating with other CI/CD tools, or implementing GitOps practices. For further exploration, consider learning about GitOps in Kubernetes.

By following this tutorial, you have successfully integrated Jenkins with Kubernetes, enabling you to build and deploy applications efficiently using the power of both tools.


PreviousKubernetes in DevOps PipelinesNext GitOps in Kubernetes

Recommended Gear

Kubernetes in DevOps PipelinesGitOps in Kubernetes