📌 Project: DevOps Python FastAPI on Kubernetes
This project demonstrates an end-to-end DevOps workflow for deploying a Python FastAPI application using Docker, Kubernetes, Helm, and GitHub Actions.
The goal of this project is to showcase real-world DevOps practices, including containerization, orchestration, Helm-based deployments, and CI automation.
🏗️ Architecture Overview
A FastAPI application provides REST endpoints (/health, /items)
The application is containerized using Docker
The container runs inside Kubernetes Pods
Kubernetes resources are managed using Helm charts
A GitHub Actions CI pipeline builds and pushes Docker images to DockerHub on every push to main
🧱 Technology Stack
Language: Python (FastAPI)
Containerization: Docker
Orchestration: Kubernetes (Minikube for local)
Packaging: Helm
CI/CD: GitHub Actions
Container Registry: DockerHub
⚙️ Application Features
/health – Health check endpoint used by Kubernetes probes
/items – Sample API endpoint
Readiness and liveness probes configured in Kubernetes
Environment-based configuration via Helm values
🚀 CI Pipeline (GitHub Actions)
The CI pipeline runs automatically on every push to the main branch and performs the following steps:
Checks out the source code
Builds a Docker image
Tags the image with:
latest
Git commit SHA
Pushes the image to DockerHub
This ensures every commit produces a traceable and reproducible container image.
☸️ Kubernetes & Helm Deployment
Application runs as a Kubernetes Deployment
Exposed internally using a ClusterIP Service
Managed using Helm for:
Replica scaling
Image version control
Environment configuration
Supports Helm lifecycle commands:
helm install
helm upgrade
helm rollback
🧪 Local Testing
Port-forward the service:
kubectl port-forward svc/fastapi-helm 10000:80 -n fastapi-devops
Test endpoints:
curl http://localhost:10000/health curl http://localhost:10000/items
🎯 Key DevOps Concepts Demonstrated
Containerized microservices
Kubernetes deployments and services
Helm-based application packaging
CI automation with GitHub Actions
Docker image versioning using commit SHA
Clean separation of application, infrastructure, and automation
📌 Future Improvements
Add CD with helm upgrade to a cloud cluster
Integrate image scanning (Trivy)
Add monitoring (Prometheus + Grafana)
Deploy to EKS / GKE