How siddheshengineer/gitops works
Project Type and Purpose
• Type: Full-stack GitOps deployment pipeline for a containerized Flask app.
• Purpose: Automate infrastructure & application deployment using GitOps principles; manage both local (k3d) and cloud (AKS via Terraform + Azure Arc) clusters; deliver continuous delivery with FluxCD and CI with GitHub Actions/CircleCI.
File Structure
• .github/workflows/ci.yaml → CI/CD definitions for building, testing, pushing Docker images, and updating GitOps manifests.
• app/ → Flask application source, Dockerfile, HTML template (hello.html) + Python requirements.
• env/arc_and_fluxCD/ → Kubernetes manifests (Namespace, Service, Deployment) for FluxCD to apply.
• env/terrform/ → Terraform scripts (aks-k8s-cluster.tf, variables.tf, etc.) to provision an Azure Kubernetes Service cluster.
• env/cluster-config.yaml → k3d cluster creation config.
• images/ → Static screenshots (architecture.png).
README for Additional Context
• Confirms use of k3d for local cluster, Azure Arc for cluster registration, FluxCD for pull-based CD, Docker for containerization, GitHub Actions/CircleCI for CI.
• Shows an existing architecture.png illustrating the flow.
Main Components
a. Developer Workstation
– Local Git repo → push to remote.
– Executes k3d cluster create & kubectl for local testing.
b. Git Repository (GitHub)
– Holds app/, env/, .github/workflows/ci.yaml.
– Triggers CI pipelines on push.
c. CI System
– GitHub Actions (or CircleCI)
– Steps: build Docker image → push to container registry (Docker Hub/Azure Container Registry) → update K8s manifests in Git (flux path).
d. Container Registry
– Stores versioned Docker images.
e. Kubernetes Cluster(s)
– Local k3d cluster (dev/test)
– Azure AKS cluster (prod) provisioned via Terraform
– Both clusters registered to Azure Arc
f. GitOps Operator
– FluxCD watches manifest directory in Git → pulls changes → applies to target cluster.
g. Application Components in K8s
– Namespace (e.g., default or custom)
– Deployment (Flask pods)
– Service (ClusterIP/LoadBalancer)
– Ingress / Port-forward for external access
h. IaC Tooling
– Terraform for AKS provisioning
– Azure Arc CLI for connecting clusters
Relationships and Data Flow
• Developer → Git push → triggers CI
• CI → builds Docker image → pushes to Registry → commits updated YAML → Git
• FluxCD → detects Git changes → pulls manifests → applies to K8s API
• Kubernetes API → schedules Pods & Services
• Azure Arc → syncs cluster state into Azure Control Plane
• Users → access Flask app via Service/Ingress
Key Architectural Patterns and Principles
• GitOps (Pull-based CD with FluxCD)
• Infrastructure-as-Code (Terraform + k3d YAML)
• Containerization (Docker)
• Immutable infrastructure & declarative configs