This project demonstrates a complete CI/CD pipeline for deploying a simple Flask web application using:
- 🐳 Docker
- 🔧 Jenkins
- ☸️ Kubernetes (via Minikube)
- ☁️ Docker Hub
GitHub Repo ➡️ flask-jenkins-aut-app
The pipeline performs the following automated steps:
- Clones the Flask app from GitHub.
- Builds a Docker image of the Flask app.
- Runs and tests the container to ensure the app is healthy.
- Pushes the image to Docker Hub.
- Deploys the updated image to a Kubernetes cluster running locally with Minikube.
| Component | Tool/Service Used |
|---|---|
| Language | Python (Flask) |
| CI/CD | Jenkins |
| Containerization | Docker |
| Container Registry | Docker Hub |
| Orchestration | Kubernetes (Minikube) |
- Pulls code from GitHub repo.
docker build -t flask-app .- Builds the app using a Dockerfile based on
python:3."latest-slim.
docker run -d --name flask-app-test -p 5000:5000 flask-app
curl -f http://localhost:5000- Confirms the app starts and responds properly.
docker tag flask-app:latest davmano/flask-app:latest
docker login -u davmano -p $DOCKER_HUB_PASSWORD
docker push davmano/flask-app:latest- Pushes the tested image to Docker Hub.
kubectl config use-context minikube
kubectl set image deployment/flask-app flask-app=davmano/flask-app:latest --record- Updates the Kubernetes deployment with the latest Docker image.
- Jenkins has Docker installed and is added to the
dockergroup. - Minikube is running locally and accessible via Jenkins.
- Jenkins has read access to Kubernetes kubeconfig and certs.
sudo mkdir -p /var/lib/jenkins/.kube
sudo cp ~/.kube/config /var/lib/jenkins/.kube/config
sudo chown -R jenkins:jenkins /var/lib/jenkins/.kubeStart Jenkins normally (your command is fine):
docker run -d \
--name jenkins \
-p 8080:8080 -p 50000:50000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts
Then exec into the container as root to install Docker CLI:
docker exec -it --user root jenkins bash
Inside the container run:
apt-get update
apt-get install -y docker.io
exit
- Docker Hub credentials stored in Jenkins using
withCredentials. - Kubeconfig manually made accessible to Jenkins user.
- Built a real-world CI/CD pipeline from scratch.
- Understood Docker image creation, tagging, and container testing.
- Deployed containers into Kubernetes using command-line tools.
- Managed Jenkins security, permissions, and pipeline scripting.
- Replace
kubectl set imagewith YAML-basedkubectl apply -f. - Add automated rollback and rollout status checks.
- Integrate with GitHub webhooks for auto-triggering builds.
- Implement Slack/email notifications.
David Mano DevOps Engineer | Cloud Enthusiast | CI/CD Practitioner
MIT License

