Skip to content

siddheshengineer/GitOps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitOps Project with K3d, Azure Arc & FluxCD

📖 Overview

This repository follows a GitOps workflow to deploy a Flask-based web application using:

  • Local Kubernetes Cluster: k3d for lightweight cluster management
  • Cluster Management: Azure Arc to integrate with Azure
  • GitOps CD Operator: FluxCD for automated deployments
  • CI/CD: GitHub Actions / CircleCI for Continuous Integration
  • Containerization: Docker

Architecture

Architecture

📂 Repository Structure

📦 gitOps-project
├── 📂 .github/workflows   # GitHub Actions CI/CD pipeline
├── 📂 env                 # Environment code web
│   ├── 📂 arc_and_ fluxCD # Kubernetes manifests for FluxCD
│   ├── 📂 terraform        # Terraform scripts
│   └──   k3d-config-file   # Config file for k3d cluster setup
├── 📂 app                 # Flask web application source code
│   ├── app.py
│   ├── templates/
│   ├── requirements.txt
│   └── Dockerfile
├── 📂 images              # screenshots
└── README.md

Planned changes

  • Migrating from GitHub to Azure DevOps

🎯 Goals

✅ Automate infrastructure deployment using GitOps principles
✅ Ensure reproducibility and consistency using FluxCD
✅ Manage a local k3d cluster integrated with Azure Arc
✅ CI/CD integration with GitHub Actions or CircleCI
✅ Containerize the Flask app and deploy it to Kubernetes


🛠️ Setup Instructions

1️⃣ Install Prerequisites

Ensure you have the following installed:


2️⃣ Setup a Local K3d Cluster

k3d cluster create gitops-cluster --servers 1 --agents 2 -p "8080:8080@loadbalancer"
kubectl get nodes  # Verify cluster is running

3️⃣ Connect K3d to Azure Arc

az login
az connectedk8s connect --name gitops-cluster --resource-group my-resource-group

4️⃣ Deploy FluxCD

flux bootstrap github \
  --owner=<GITHUB_USERNAME> \
  --repository=<GITHUB_REPO> \
  --path=./manifests \
  --personal

5️⃣ Deploy the Flask App

kubectl apply -f manifests/

🔄 CI/CD Pipeline

GitHub Actions (Optional)

A GitHub Actions pipeline (.github/workflows/deploy.yml) is included to:

  • Build & push the Docker image
  • Update Kubernetes manifests
  • Trigger a FluxCD sync

CircleCI (Optional)

A .circleci/config.yml is also available for CircleCI integration.

To trigger deployments, push changes to the repository:

git add .
git commit -m "Deploy new version"
git push origin main

Access the Application

After deployment, access the Flask app via:

kubectl port-forward svc/webapp-service 8080:8080

Then visit:
📌 http://localhost:8080


Useful Commands

# Check FluxCD sync status
flux get all

# List running pods
kubectl get pods -n default

# View app logs
kubectl logs -l app=webapp

Contributing

Contributions are welcome! Feel free to submit a pull request.


Support

If you have any issues, open a GitHub Issue or contact me. 🚀

About

GitOps project - Using fluxCD, Azure Arc for cluster management (hybrid cloud)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published