Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Kubernetes Deployment Automation using Python (Docker Hub + Kind)

📌 Overview

This project demonstrates a Python-based automation system for deploying containerized applications on Kubernetes using Kind (Kubernetes in Docker) and Docker Hub as an image registry. It reflects real-world DevOps workflows with CI/CD-ready architecture.


🧠 Key Features

  • ✅ Automated Kubernetes deployment using Python
  • 🔄 Auto-healing mechanism for failed pods
  • 📊 Pod monitoring via script
  • 🐳 Docker image build & push to Docker Hub
  • ☸️ Deployment on Kind Kubernetes cluster
  • 📦 Scalable architecture using replicas

🛠️ Tech Stack

  • Programming: Python, Node.js
  • Containerization: Docker
  • Registry: Docker Hub
  • Orchestration: Kubernetes (Kind)
  • Automation: Python

📁 Project Structure

k8s-python-automation/
│
├── app/
├── k8s/
│   ├── deployment.yaml
│   ├── service.yaml
│
├── Dockerfile
├── deploy.py
├── requirements.txt
└── README.md

⚙️ How It Works

  1. Application is containerized using Docker
  2. Image is pushed to Docker Hub
  3. Kubernetes (Kind) pulls image from Docker Hub
  4. Python script deploys application using YAML
  5. Script monitors and auto-heals pods

🚀 Getting Started

🔧 Prerequisites

  • Docker installed
  • Docker Hub account
  • Kind installed
  • kubectl configured
  • Python installed

📦 Step 1 — Clone Repository

git clone https://github.com/your-username/k8s-python-automation.git
cd k8s-python-automation

🐳 Step 2 — Build & Push Docker Image

docker build -t nodejsonapp/devops-app:latest .
docker push nodejsonapp/devops-app:latest

☸️ Step 3 — Create Kind Cluster

kind create cluster --name devops-cluster

🐍 Step 4 — Run Automation Script

python deploy.py

🌐 Step 5 — Access Application

kubectl port-forward service/devops-service 8080:80

Open:

http://localhost:8080

⚠️ Important Notes

  • Ensure Docker image is pushed before deployment
  • Use imagePullPolicy: Always
  • Internet required for pulling image

💡 Learning Outcomes

  • Docker image lifecycle (build → push → pull)
  • Kubernetes deployment using external registry
  • DevOps automation using Python
  • Local cluster management using Kind

👨‍💻 Author

Aijaz Ahmed DevOps Engineer 🔗 https://github.com/Aijazkhan123


⭐ Give it a star if you like it!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages