Security gates in a Jenkins-to-Kubernetes pipeline
A Jenkins pipeline with security gates at build and deploy, shipping a three-tier Java app to self-managed Kubernetes on every push.
Pipeline stages
- GitHub webhook
- Maven build
- SonarQube
- OWASP Dependency-Check
- Docker image
- Trivy scan
- Kubernetes deploy
Context
A personal project: a CI/CD pipeline with security gates built into its build and deploy stages. It ships a three-tier Java application to a self-managed Kubernetes cluster, and it runs on every push.
Architecture
Pick one to light up the parts behind it.
Jenkins pipeline · Runs on every push
- Maven build · Java app
- SonarQube · static analysis
- Dependency-Check · OWASP scan
- Docker image
- Trivy · image scan
- Deploy · to Kubernetes
- GitHub · push webhook
Kubernetes cluster · Self-managed
- Three-tier Java app
Connections
- GitHub to Jenkins pipeline
- Maven build to SonarQube
- SonarQube to Dependency-Check
- Dependency-Check to Docker image
- Docker image to Trivy
- Trivy to Deploy
- Deploy to Kubernetes cluster
A push to GitHub fires a webhook, and Jenkins runs the pipeline. Maven builds the application, SonarQube runs static analysis on the code, and OWASP Dependency-Check scans its dependencies. The pipeline then builds a Docker image, Trivy scans that image, and the application is deployed to the cluster. SonarQube, Dependency-Check and Trivy are the security gates.
What I built
My part
- The Jenkins pipeline from end to end, with its three security gates.
- The GitHub webhook that starts it on every push.
- The deployment to the self-managed Kubernetes cluster.
Results
Every push starts the pipeline automatically, and the whole build-scan-deploy workflow runs without a manual step.