_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

CI/CD Pipeline for Kubernetes with Jenkins

14. 06. 2017 2 min read CORE SYSTEMSdevops
CI/CD Pipeline for Kubernetes with Jenkins

Having a Kubernetes cluster is half the battle. The other half is getting code into it — reliably, quickly, and automatically. We’re sharing our CI/CD pipeline with Jenkins, which has undergone a dramatic evolution over the past few months.

From Jenkins Freestyle to Pipeline-as-Code

Our old Jenkins jobs were freestyle projects — click-configured in the GUI. Unreliable, non-reproducible. Jenkins Pipeline changed that: the entire build process is a Groovy script in a Jenkinsfile, versioned directly in the project repository.

Jenkins on Kubernetes

Jenkins itself runs in the Kubernetes cluster. The Kubernetes plugin for Jenkins dynamically launches build agents as pods — each build gets a clean, isolated agent. No “polluted” build environments.

When there’s nothing to build, only the Jenkins master runs. Zero cost for idle agents. During peak load, the cluster automatically scales up.

Our Standard Jenkinsfile

pipeline {
    agent {
        kubernetes {
            yaml |-
              apiVersion: v1
              kind: Pod
              spec:
                containers:
                - name: maven
                  image: maven:3.5-jdk-8
                - name: docker
                  image: docker:17.06
        }
    }
    stages {
        stage('Build') {
            steps { container('maven') { sh 'mvn clean package' } }
        }
        stage('Docker Build') {
            steps {
                container('docker') {
                    sh "docker build -t registry.core.cz/app:${BUILD_NUMBER} ."
                    sh "docker push registry.core.cz/app:${BUILD_NUMBER}"
                }
            }
        }
        stage('Deploy') {
            steps {
                sh "helm upgrade --install app ./chart --set image.tag=${BUILD_NUMBER}"
            }
        }
    }
}

Deployment Strategy

For staging: automatic deploy after every successful build. For production: a manual approval step in the Jenkins Pipeline. Helm upgrade --install ensures a rolling update with zero downtime.

Rollback is simple: helm rollback release-name revision-number. Helm maintains a history of revisions.

What We Want to Improve

  • Canary deployments — currently just rolling updates
  • Automated smoke tests after deploy
  • Image vulnerability scanning in the pipeline
  • GitOps approach — deploy triggered by changes in Git

CI/CD Is the Key to Agile Kubernetes

Kubernetes without automated CI/CD is like a race car without fuel. Jenkins with Pipeline-as-Code and the Kubernetes plugin lets us deploy dozens of services daily with confidence.

ci/cdjenkinskuberneteshelm
Share:

CORE SYSTEMS

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us