Skip to content

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

devops-k8s-3tier-app

CI/CD Pipeline License: MIT Docker Kubernetes Python

A production-grade, multi-container 3-tier microservices application stack containerized with Docker, automated via GitHub Actions CI/CD, and orchestrated on Kubernetes using Minikube.


πŸ“Έ Architecture & Live Demonstration

System Architecture Diagram

System Architecture Diagram

Key Deployment & Pipeline Highlights

Kubernetes Deployment Status GitHub Actions CI/CD Success
Kubernetes Cluster Status CI/CD Pipeline Success
End-to-End API Verification K8s Data Persistence Proof
API Verification Data Persistence Proof

🎯 Overview & Motivation

Modern cloud applications require robust microservice separation, automated continuous integration, resilient container orchestration, and self-healing storage solutions.

devops-k8s-3tier-app demonstrates end-to-end DevOps practices by implementing a 3-tier architecture:

  • Presentation Layer: Nginx reverse proxy handling HTTP traffic routing and security header enforcement.
  • Application Layer: Flask REST API running under a multi-worker Gunicorn WSGI server with MySQL connection pooling.
  • Data Layer: MySQL 8.0 relational database with persistent storage volume claims.

This repository serves as a flagship portfolio piece showcasing real-world cloud engineering, Docker containerization, Kubernetes manifest design, and automated pipeline execution.


✨ Features

  • πŸš€ RESTful Microservices Backend: Clean REST API offering /health status monitoring and complete item CRUD endpoints.
  • ⚑ Production-Ready WSGI & Connection Pooling: Powered by Gunicorn WSGI server and thread-safe MySQL connection pooling to prevent connection starvation.
  • πŸ›‘οΈ Container Security & Isolation: Non-root container execution (appuser UID 10001), security response headers in Nginx (X-Frame-Options, X-Content-Type-Options), and Kubernetes network isolation.
  • πŸ“¦ Docker Compose Local Development: One-command multi-container local startup with healthchecks and automatic container dependencies.
  • ☸️ Kubernetes Minikube Deployment: Declarative K8s manifests specifying Namespace, ConfigMaps, Secrets, PV/PVC storage, health probes (readiness & liveness), resource limits, and service exposing (NodePort & ClusterIP).
  • πŸ”„ Automated CI/CD Pipeline: GitHub Actions workflow executing Pytest automated testing prior to building and pushing Docker images to DockerHub.

πŸ“š Technical Documentation Directory

Document Description
πŸ“– Architecture Specification In-depth technical breakdown of network topology, tiers, security context, and K8s resources.
πŸ“œ Architectural Decision Records (ADRs) Records of core technical decisions (Nginx proxy, Gunicorn WSGI, MySQL pool, NodePort).
πŸ”Œ REST API Reference Full endpoint documentation, request/response schemas, error codes, and cURL examples.
πŸ› οΈ Setup & Installation Guide Detailed installation steps for Docker Compose local dev and Minikube K8s setup.
βš™οΈ Usage & Operations Guide Operational workflows, cluster scaling commands, logging streams, and troubleshooting.
πŸ’» Development & Testing Guide Guidelines for local Python virtualenvs, running Pytest suites, and container builds.

πŸ› οΈ Tech Stack

  • Backend: Python 3.11, Flask 3.0, Gunicorn 21.2
  • Database: MySQL 8.0, mysql-connector-python 8.2
  • Reverse Proxy: Nginx (Alpine)
  • Containerization: Docker, Docker Compose
  • Orchestration: Kubernetes (Minikube), kubectl
  • Automation & Testing: Bash, Pytest, GitHub Actions

⚑ Installation & Quickstart

Prerequisites

1. Local Development (Docker Compose)

git clone https://github.com/sedmugen/devops-k8s-3tier-app.git
cd devops-k8s-3tier-app
cp .env.example .env
docker compose -f app/docker-compose.yml up -d --build

Access the application at http://localhost/health.

2. Kubernetes Cluster Deployment (Minikube)

chmod +x start.sh
./start.sh

See docs/setup.md for detailed cluster setup and manifest validation procedures.


πŸ“– API Documentation Overview

For full request/response payloads, see docs/api.md.

# Check health
curl -i http://localhost/health

# Create item
curl -i -X POST http://localhost/api/items \
  -H "Content-Type: application/json" \
  -d '{"name": "DevOps Portfolio", "description": "3-Tier Stack on K8s"}'

# List items
curl -i http://localhost/api/items

# Delete item
curl -i -X DELETE http://localhost/api/items/1

πŸ—ΊοΈ Roadmap & Testing

  • Gunicorn WSGI multi-worker integration
  • Thread-safe MySQL connection pooling
  • Non-root container security context (appuser UID 10001)
  • Pytest automated test suite & CI/CD pipeline integration
  • Ingress Controller with TLS cert-manager integration
  • Prometheus & Grafana monitoring dashboards

πŸ“„ License & Credits

This project is licensed under the MIT License - see the LICENSE file for details.

Developed & Maintained by sedmugen.

About

Production-ready 3-tier microservices stack (Nginx, Flask REST API, MySQL) containerized with Docker, automated via GitHub Actions CI/CD, and orchestrated on Kubernetes (Minikube).

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages