Operations 14 min read

Implementing CI/CD with Jenkins and GitOps on Kubernetes

This article provides a comprehensive step‑by‑step guide to building a CI/CD pipeline using Jenkins, GitOps, ArgoCD, and Kubernetes, covering software installation, plugin configuration, shared library setup, Jenkinsfile creation, image building, deployment with Kustomize, and webhook integration with GitLab.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Implementing CI/CD with Jenkins and GitOps on Kubernetes

The article introduces a CI/CD solution that leverages Jenkins and GitOps to automate building, testing, and deploying Java applications on a Kubernetes 1.17.9 cluster, integrating tools such as Docker 19.03.13, ArgoCD 1.8.0, GitLab Community Edition 11.8.1, SonarQube 8.5.1, and Traefik 2.3.3.

Key technologies include Jenkins shared libraries, pipelines, and Jenkinsfiles; ArgoCD for continuous delivery; SonarQube API for code quality checks; and Kustomize for manifest customization. The guide lists required Jenkins plugins (e.g., Kubernetes, AnsiColor, HTTP Request, SonarQube Scanner) and shows how to configure Kubernetes cloud settings and email notifications in Jenkins.

Sample shared library code is provided, such as the build.groovy helper:

package org.devops

def DockerBuild(buildShell){
    sh "${buildShell}"
}

and the sonarqube.groovy script that runs SonarScanner and parses results. The main Jenkinsfile demonstrates a multi‑stage pipeline that checks out code, builds with Maven, scans with SonarQube, builds Docker images, pushes to a registry, and deploys via Kustomize:

pipeline {
    agent { kubernetes { label labels; yaml "..." } }
    stages {
        stage('GetCode') { steps { checkout scm } }
        stage('Build&Test') { steps { container('maven') { sh 'mvn clean package' } } }
        stage('CodeScanner') { steps { container('sonar-scanner') { /* SonarQube scan */ } } }
        stage('BuildImage') { steps { /* docker build & push */ } }
        stage('Deploy') { steps { container('kustomize') { /* kustomize edit set image */ } } }
    }
    post { success { sendEmail.SendEmail('Build succeeded', toEmailUser) } }
}

After configuring Jenkins, the article explains how to set up ArgoCD to sync the GitLab‑hosted YAML repository, create an application, and handle a known Ingress health‑check issue. Finally, it details GitLab webhook configuration to trigger Jenkins pipelines automatically, completing an end‑to‑end CI/CD workflow.

CI/CDKubernetesDevOpsGitOpsJenkinsArgoCD
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.