🚀End-to-End DevOps CI/CD Pipeline: Docker + Kubernetes + GitHub Actions

🚀End-to-End DevOps CI/CD Pipeline: Docker + Kubernetes + GitHub Actions

Project Overview Successfully architected and deployed a complete production-ready CI/CD pipeline integrating Docker containerization, Kubernetes orchestration, and GitHub Actions automation. This end-to-end solution demonstrates modern DevOps practices for scalable application deployment.

Technical Stack

  • Containerization: Docker with Python-based HTTP server
  • Orchestration: Kubernetes with Minikube for local development
  • CI/CD Pipeline: GitHub Actions for automated build and deployment
  • Registry: Docker Hub for centralized image management
  • Infrastructure: 3-replica Kubernetes deployment with Load Balancer service

Key Achievements

Automated Docker Build Pipeline

  • Triggered on every GitHub push to main branch
  • Builds optimized Docker images with semantic versioning
  • Automatically pushes to Docker Hub registry

Secure Secrets Management

  • Docker Hub credentials stored as GitHub Secrets
  • Kubeconfig encrypted and securely configured
  • Zero hardcoded credentials in codebase

Zero-Downtime Deployment

  • Automatic Kubernetes deployment updates
  • Rolling updates with health checks
  • Service availability monitoring

Complete Automation

  • Code → Build → Push → Deploy cycle fully automated
  • No manual intervention required
  • Multi-replica high availability setup

Architecture Flow

Developer Push → GitHub Actions Workflow → Build Docker Image

→ Push to Registry → Update K8s Deployment → Auto-Rollout

→ Running on Kubernetes

Skills Demonstrated Docker | Kubernetes | GitHub Actions | CI/CD | DevOps | Infrastructure Automation | Container Orchestration | Cloud Native Development

Outcome A robust, scalable deployment pipeline that reduces manual overhead, ensures consistent deployments, and enables rapid iteration cycles for application development and delivery.

Complete reference guide as example..

# Build Docker image locally

docker build -t myfirstimage:v1 .

# Build and tag for Docker Hub

docker build -t sarvesh250725/myfirstimage:latest .

# Push image to Docker Hub

docker push sarvesh250725/myfirstimage:latest

# Run Docker container locally

docker run -p 80:80 sarvesh250725/myfirstimage:latest

# List Docker images

docker images

# Remove Docker image

docker rmi sarvesh250725/myfirstimage:latest

# Start Minikube

minikube start

# Stop Minikube

minikube stop

# Delete Minikube cluster

minikube delete

# Check cluster status

kubectl cluster-info

# Get all pods

kubectl get pods

# Get pods with details

kubectl get pods -o wide

# Get services

kubectl get svc

# Get deployments

kubectl get deployments

# Describe a pod

kubectl describe pod <pod-name>

# View pod logs

kubectl logs <pod-name>

# View logs in real-time

kubectl logs -f <pod-name>

# Execute command in pod

kubectl exec -it <pod-name> -- bash

# Delete a pod

kubectl delete pod <pod-name>

# Delete a deployment

kubectl delete deployment my-app-deployment

# Apply/deploy YAML files

kubectl apply -f deployment.yaml

kubectl apply -f service.yaml

# Update deployment image

kubectl set image deployment/my-app-deployment my-app-container=sarvesh250725/myfirstimage:latest

# Update with commit SHA (from CI/CD)

kubectl set image deployment/my-app-deployment my-app-container=sarvesh250725/myfirstimage:${{ github.sha }}

# Check rollout status

kubectl rollout status deployment/my-app-deployment

# View rollout history

kubectl rollout history deployment/my-app-deployment

# Rollback to previous version

kubectl rollout undo deployment/my-app-deployment

# Scale deployment replicas

kubectl scale deployment my-app-deployment --replicas=5

# View deployment details

kubectl describe deployment my-app-deployment

# Initialize git repository

git init

# Configure git user

git config --global user.email "your-email@example.com"

git config --global user.name "Your Name"

# Add all files to staging

git add .

# Commit changes

git commit -m "Your commit message"

# Push to GitHub

git push origin main

# Pull latest changes

git pull origin main

# Check git status

git status

# View commit history

git log --oneline

# Add remote repository

git remote add origin https://github.com/username/repo.git

# Set remote URL

git remote set-url origin https://github.com/username/repo.git

# Push empty commit to trigger workflow

git commit -m "Trigger CI/CD" --allow-empty

git push

# Encode kubeconfig to base64

[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("$env:USERPROFILE\.kube\config")) | Set-Clipboard

# Configure kubeconfig in GitHub Actions

mkdir -p $HOME/.kube

echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > $HOME/.kube/config

chmod 600 $HOME/.kube/config

# Set GitHub secrets (via GitHub web UI Settings → Secrets and variables → Actions)

DOCKER_USERNAME: sarvesh250725

DOCKER_PASSWORD: <your-docker-token>

KUBE_CONFIG: <base64-encoded-kubeconfig>

# Watch pods in real-time

kubectl get pods -w

# Watch deployments

kubectl get deployments -w

# Get events in cluster

kubectl get events

# Check resource usage

kubectl top nodes

kubectl top pods

# Debug pod issues

kubectl describe pod <pod-name>

kubectl logs <pod-name> --previous

# Access pod shell

kubectl exec -it <pod-name> -- /bin/bash

# Port forward to local machine

kubectl port-forward <pod-name> 8080:80

# Get service details

kubectl get svc my-app-service

# Access LoadBalancer service

minikube service my-app-service

# Port forward service

kubectl port-forward svc/my-app-service 8080:80

# Get service IP

kubectl get svc my-app-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}'

# 1. Make code changes

echo "# Updated app" >> README.md

# 2. Commit and push (triggers CI/CD)

git add .

git commit -m "Update app"

git push origin main

# 3. Monitor GitHub Actions

# Visit: https://github.com/username/repo/actions

# 4. Check Kubernetes deployment

kubectl get pods

kubectl rollout status deployment/my-app-deployment

# 5. Verify Docker image on Hub

# Visit: https://hub.docker.com/r/sarvesh250725/myfirstimage

# 6. Access the running app

kubectl get svc

minikube service my-app-service

# Delete all pods

kubectl delete pod --all

# Delete all deployments

kubectl delete deployment --all

# Delete all services

kubectl delete svc --all

# Stop all containers

docker stop $(docker ps -q)

# Remove all Docker images

docker rmi $(docker images -q)

# Clean up Minikube

minikube delete

# One-time setup

minikube start

kubectl apply -f deployment.yaml

kubectl apply -f service.yaml

# Verify setup

kubectl get pods

kubectl get svc

# Test deployment

kubectl port-forward svc/my-app-service 8080:80

# Visit: http://localhost:8080

Save this as a reference document! Print it out or bookmark for easy access during

To view or add a comment, sign in

More articles by Sarvesh Kumar

Others also viewed

Explore content categories