A production-ready local Kubernetes environment using GitOps principles with Argo CD, complete with ingress controller, monitoring stack, and LoadBalancer support.
This repository provides a fully declarative, GitOps-driven local Kubernetes setup that mimics production cloud environments. Everything is managed from Git - just run a few commands and you'll have:
- Multi-node Kubernetes cluster (Kind - Kubernetes in Docker)
- Argo CD for GitOps continuous deployment
- HAProxy Ingress Controller for HTTP/HTTPS routing
- LoadBalancer support via cloud-provider-kind (just like AWS/GCP)
- Prometheus + Grafana monitoring stack
- App-of-Apps pattern for managing infrastructure and applications
- Sample applications ready to run
Perfect for local development, testing GitOps workflows, or learning Kubernetes patterns!
- Docker Desktop or Podman (running)
- kubectl (Kubernetes CLI)
- kind (Kubernetes in Docker) - Install
- GNU Make (should be pre-installed on macOS/Linux)
- Git (to clone this repo)
# 1. Clone this repository
git clone https://github.com/charalamposlamprou/kind-gitops-cluster.git
cd kind-gitops-cluster
# 2. Create the local Kubernetes cluster
make cluster-up
# 3. Install Argo CD and bootstrap GitOps
make bootstrap
# 4. Deploy all applications
make apps-installThat's it! Argo CD will now manage everything from Git.
# Check all applications are synced and healthy
kubectl get applications -n argocd
# You should see:
# apps-app Synced Healthy
# infra-app Synced Healthy
# ingress-haproxy Synced Healthy
# loki Synced Healthy
# monitoring-stack Synced Healthy
# otel-collector Synced Healthy
# prometheus-crds Synced Healthy
# root-app Synced Healthy
# tempo Synced Healthy# Get all application URLs instantly
make urlsOutput:
📱 Application URLs (via LoadBalancer):
🚀 Microservice A: http://microservice-a.127.0.0.1.nip.io:63404
🚀 Microservice B: http://microservice-b.127.0.0.1.nip.io:63404
📊 Grafana: http://grafana.127.0.0.1.nip.io:63404 (admin/admin, Loki+Tempo ready)
📈 Prometheus: http://prometheus.127.0.0.1.nip.io:63404
🔄 Argo CD: http://argocd.127.0.0.1.nip.io:63404
No DNS configuration needed! The apps use *.127.0.0.1.nip.io domains which work automatically without editing /etc/hosts.
💡 Want different access methods? See docs/ACCESSING-APPS.md for 5 complete approaches including port-forward, NodePort with fixed ports 80/443, and more.
This repository uses Argo CD's App-of-Apps pattern - a hierarchical structure where one root application creates and manages child applications:
root-app (bootstrap/root-application.yaml)
|
|-- infra-app -> infrastructure/
| |-- prometheus-crds (CRDs for monitoring)
| |-- ingress-haproxy (HAProxy ingress controller)
| |-- monitoring-stack (Prometheus + Grafana)
| |-- loki (logs backend)
| |-- tempo (traces backend)
| `-- otel-collector (DaemonSet telemetry pipeline)
|
`-- apps-app -> applications/
|-- microservice-a
`-- microservice-b
Benefits:
- Add new apps by just creating a directory - Argo CD discovers them automatically
- Infrastructure is deployed before applications
- Everything is version-controlled and declarative
- Easy rollback via Git revert
| Component | Purpose | Version |
|---|---|---|
| Kind | Local Kubernetes cluster | v1.33.1 |
| Argo CD | GitOps continuous deployment | v2.13.2 |
| HAProxy Ingress | HTTP/HTTPS routing | v3.1.9 (chart 1.46.0) |
| cloud-provider-kind | LoadBalancer emulation | v0.7.0 |
| kube-prometheus-stack | Monitoring (Prometheus + Grafana) | v70.0.0 |
| Loki | Logs storage/query backend | chart 2.10.2 |
| Tempo | Distributed tracing backend | chart 1.10.1 |
| OpenTelemetry Collector | DaemonSet telemetry pipeline | chart 0.89.0 |
| Microservice A/B | Sample applications | latest |
├── bootstrap/ # App-of-Apps entry point
│ ├── root-application.yaml # Root app (creates infra-app + apps-app)
│ └── apps/
│ ├── infrastructure.yaml # Child app pointing to infrastructure/
│ └── applications.yaml # Child app pointing to applications/
│
├── infrastructure/ # Infrastructure components
│ ├── cluster/
│ │ └── kind-config.yaml # Kind cluster configuration (4 nodes)
│ ├── argocd/
│ │ ├── base/ # Argo CD base manifests
│ │ └── overlays/local/ # Local environment overlay
│ ├── ingress/
│ │ └── haproxy-application.yaml # HAProxy ingress Argo app
│ ├── monitoring/
│ │ ├── prometheus-crds/ # Prometheus Operator CRDs
│ │ ├── prometheus-crds-application.yaml
│ │ ├── kube-prometheus-stack-application.yaml
│ │ ├── loki-application.yaml
│ │ ├── tempo-application.yaml
│ │ ├── otel-collector-application.yaml
│ │ └── ingress-monitoring.yaml # Grafana/Prometheus ingress
│ └── cloud-provider/
│ └── compose.yaml # cloud-provider-kind (host component)
│
├── applications/ # Your applications go here
│ ├── apps/ # Argo CD Application resources
│ │ ├── microservice-a-application.yaml
│ │ └── microservice-b-application.yaml
│ └── microservices/
│ ├── microservice-a/ # Example nginx deployment A
│ └── microservice-b/ # Example nginx deployment B
│
├── docs/
│ └── ACCESSING-APPS.md # Comprehensive guide: 5 ways to access apps
│
├── Makefile # Lifecycle automation
└── README.md # This file
# Create/start the local Kubernetes cluster
make cluster-up
# Stop and delete the cluster
make cluster-down# Bootstrap Argo CD (first-time setup)
make bootstrap
# Deploy/sync all applications
make apps-install
# Get all application URLs (no /etc/hosts needed!)
make urls
# Get Argo CD admin password
make argocd-password
# Check Argo CD application status
make argocd-status# Start cloud-provider-kind
make cloud-provider-up
# Stop cloud-provider-kind
make cloud-provider-down
# Restart and wait for readiness
make cloud-provider-restartGet all URLs with one command:
make urlsThis shows URLs for all services using nip.io DNS (no /etc/hosts editing required!):
📱 Application URLs (via LoadBalancer):
🚀 Microservice A: http://microservice-a.127.0.0.1.nip.io:63404
🚀 Microservice B: http://microservice-b.127.0.0.1.nip.io:63404
📊 Grafana: http://grafana.127.0.0.1.nip.io:63404 (admin/admin)
📈 Prometheus: http://prometheus.127.0.0.1.nip.io:63404
🔄 Argo CD: http://argocd.127.0.0.1.nip.io:63404
Just copy/paste the URLs into your browser! 🎉
Note: The port number changes when you recreate the cluster. Just run
make urlsagain to get the current URLs.
Need a different access method? We've got you covered with 5 complete options:
📖 See docs/ACCESSING-APPS.md for the comprehensive guide:
- nip.io DNS (✅ current) - Already configured! No setup needed, works immediately
- kubectl port-forward (🚀 quick testing) - Standard ports (3000, 9090, 8080), no config changes
- NodePort + fixed ports (🎯 production-like) - Use ports 80/443, predictable and stable
- hostPort + DaemonSet (🏃 advanced) - Direct node binding, high availability
- Host header with curl (🔄 automation) - Test ingress routing without browser
Comparison:
| Method | Ports | Setup | Ingress Testing | Best For |
|---|---|---|---|---|
| nip.io | Random | None | ✅ Yes | Daily use (current) |
| port-forward | Standard | None | ❌ No | Quick service testing |
| NodePort | 80/443 | Cluster rebuild | ✅ Yes | Production-like setup |
| hostPort | 80/443 | Cluster rebuild | ✅ Yes | Advanced scenarios |
| Host header | Random | None | ✅ Yes | CI/CD & automation |
For quick testing without ingress:
# Grafana
kubectl port-forward -n monitoring svc/monitoring-grafana 3000:80
# Access: http://localhost:3000 (admin/admin)
# Prometheus
kubectl port-forward -n monitoring svc/monitoring-kube-prometheus-prometheus 9090:9090
# Access: http://localhost:9090
# Argo CD
kubectl port-forward -n argocd svc/argocd-server 8080:443
# Access: https://localhost:8080 (admin/<password from make argocd-password>)
# Microservice A
kubectl port-forward -n apps svc/service-a 8081:80
# Access: http://localhost:8081
# Microservice B
kubectl port-forward -n apps svc/service-b 8082:80
# Access: http://localhost:8082💡 Tip: For production-like environments with ports 80/443, see the NodePort configuration in docs/ACCESSING-APPS.md.
After syncing apps, run a quick end-to-end validation.
# Automated smoke test (Prometheus scrape + Tempo trace + collector-to-Loki export counter)
make test-otel# Verify PodMonitor exists for the OpenTelemetry Collector (daemonset mode)
kubectl get podmonitor -n monitoring | grep otel-collector
# Port-forward Prometheus
kubectl port-forward -n monitoring svc/monitoring-kube-prometheus-prometheus 9090:9090Open Prometheus and run this query:
sum by (job, instance) (up{namespace="monitoring", job=~".*otel-collector.*"})
Expected result: one up=1 series per collector target.
Optional traffic-based checks (after sending telemetry to the collector):
sum(rate(otelcol_exporter_sent_spans[5m]))
sum(rate(otelcol_exporter_sent_log_records[5m]))
Grafana quick checks:
- Open Grafana (
make urls) and verify data sourcesPrometheus,Loki, andTempoare healthy in Connections -> Data sources. - In Explore, select
Tempoand run a trace search. - In Explore, select
Lokiand run{namespace="monitoring"}to confirm log ingestion.
This setup uses cloud-provider-kind to emulate cloud LoadBalancers (AWS ELB, GCP LB, Azure LB), providing a production-like environment locally.
# Check HAProxy ingress controller has an EXTERNAL-IP
kubectl get svc -n networking haproxy-kubernetes-ingress
# Output should show:
# NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
# haproxy-kubernetes-ingress LoadBalancer 10.96.104.30 172.18.0.7 80:31505/TCP,443:30409/TCP✅ If you see an EXTERNAL-IP (e.g., 172.18.0.7), LoadBalancer is working!
❌ If stuck on <pending>, check cloud-provider-kind:
docker ps | grep cloud-provider
# Should show: kind-cloud-provider container running
# Check logs
docker logs kind-cloud-provider
# Restart if needed
make cloud-provider-restartVerify ingress routing works correctly:
# Get the envoy proxy port (LoadBalancer frontend)
ENVOY_PORT=$(docker port $(docker ps -q --filter "ancestor=envoyproxy/envoy:v1.33.2") 80/tcp | cut -d':' -f2)
# Test demo app ingress
curl -v http://demo.127.0.0.1.nip.io:${ENVOY_PORT}
# Should return: nginx welcome page
# Test Grafana ingress
curl -v http://grafana.127.0.0.1.nip.io:${ENVOY_PORT}
# Should return: Grafana login page (302 redirect)
# Test Prometheus ingress
curl -v http://prometheus.127.0.0.1.nip.io:${ENVOY_PORT}
# Should return: Prometheus UI HTML
# Test with Host header (alternative - for automation/CI)
curl -H "Host: demo.127.0.0.1.nip.io" http://localhost:${ENVOY_PORT}
# Should return: nginx welcome page# List all ingress resources
kubectl get ingress --all-namespaces
# Example output:
# NAMESPACE NAME CLASS HOSTS ADDRESS PORTS
# apps ingress-a haproxy demo.127.0.0.1.nip.io 172.18.0.7 80
# monitoring ingress-monitoring haproxy grafana.127.0.0.1.nip.io 172.18.0.7 80
# prometheus.127.0.0.1.nip.io
# Detailed view of specific ingress
kubectl describe ingress -n apps ingress-aThe complete request path: Browser → Envoy → HAProxy → Service → Pod
┌─────────────┐
│ Browser │
│ (your Mac) │
└──────┬──────┘
│ http://demo.127.0.0.1.nip.io:63404
▼
┌─────────────────────────────────────────┐
│ Envoy Proxy (cloud-provider-kind) │
│ Docker container on host │
│ Maps: 0.0.0.0:63404 → 172.18.0.7:80 │
└──────┬──────────────────────────────────┘
│ Forward to LoadBalancer IP
▼
┌─────────────────────────────────────────┐
│ HAProxy Ingress Controller │
│ LoadBalancer: 172.18.0.7:80 │
│ (inside Kind cluster) │
└──────┬──────────────────────────────────┘
│ Route based on Host header
▼
┌─────────────────────────────────────────┐
│ Backend Service (ClusterIP) │
│ service-a, monitoring-grafana, etc. │
└──────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Application Pods │
│ nginx, grafana, prometheus, etc. │
└─────────────────────────────────────────┘
This mimics cloud environments where:
- Envoy = Cloud provider's edge router/load balancer
- HAProxy = Application load balancer (ALB/NLB)
- Service = Kubernetes service abstraction
- Pods = Your application containers
# 1. Check envoy proxy is routing to HAProxy LoadBalancer
docker port $(docker ps -q --filter "ancestor=envoyproxy/envoy:v1.33.2")
# 2. Verify HAProxy ingress controller pods are running
kubectl get pods -n networking
# 3. Check backend service endpoints
kubectl get endpoints -n apps service-a
kubectl get endpoints -n monitoring monitoring-grafana
# 4. Test end-to-end connectivity
curl -I http://demo.127.0.0.1.nip.io:${ENVOY_PORT}
# Should return: HTTP/1.1 200 OK
# 5. Verify ingress logs (optional)
kubectl logs -n networking -l app.kubernetes.io/name=kubernetes-ingress --tail=50The repository includes scripts/test-ingress.sh to verify all ingresses:
./scripts/test-ingress.shThis tests all ingress routes and reports HTTP status codes (200 = success, 302 = redirect to login).
Adding a new application is simple - Argo CD will discover it automatically!
mkdir -p applications/my-appCreate applications/my-app/kustomization.yaml:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- deployment.yaml
- service.yamlAdd your manifests (namespace.yaml, deployment.yaml, etc.)
git add applications/my-app/
git commit -m "Add my-app"
git pushmake apps-installThat's it! Argo CD automatically discovers the new directory and creates an application for it.
# Make sure Docker/Podman is running
docker info
# Delete and recreate cluster
make cluster-down
make cluster-up# Check detailed status
kubectl get application <app-name> -n argocd -o yaml
# Force refresh
kubectl patch application <app-name> -n argocd --type merge -p '{"operation":{"initiatedBy":{"username":"admin"},"sync":{}}}'# Check cloud-provider-kind is running
docker ps | grep cloud-provider
# Restart cloud provider
make cloud-provider-restart# Get admin password
make argocd-password
# Forward port manually
kubectl port-forward svc/argocd-server -n argocd 8080:443
# Access: https://localhost:8080 (accept self-signed cert)GitOps & Argo CD:
Kubernetes:
Monitoring:
The App-of-Apps pattern provides:
- Declarative hierarchy - Applications create other applications
- Separation of concerns - Infrastructure vs workloads
- Automatic discovery - Add a directory, get an app
- Dependency ordering - Via sync waves (-1 for CRDs, 0 for apps)
make cluster-upcreates a 4-node Kind cluster with proper port mappingsmake bootstrapapplies Argo CD via Kustomize (imperative, one-time only)- Root application is created pointing to
bootstrap/apps/ - Root app syncs and creates
infra-appandapps-app infra-appscansinfrastructure/and creates child apps (CRDs, ingress, monitoring)apps-appscansapplications/and creates application deployments- All subsequent changes are GitOps - commit to Git, Argo CD syncs automatically
Prometheus CRDs from Helm chart v70.0.0 have oversized annotations (>262KB limit). We:
- Fetch official CRDs from prometheus-operator GitHub releases (minimal annotations)
- Use sync wave
-1to install CRDs before monitoring-stack (wave0) - Enable
skipCrds: truein Helm chart to avoid annotation overflow
All make targets are safe to re-run:
cluster-upchecks if cluster exists before creatingbootstrapuseskubectl apply(safe for existing resources)apps-installtriggers refresh (no side effects)
Contributions welcome! This is a reference implementation - feel free to fork and customize for your needs.
All changes to this repository follow a Spec-Driven Development workflow. Every task goes through three stages before a single file is touched.
/specs DEVOPS-1234 <description> → branch created + spec generated
/plan DEVOPS-1234 → plan generated from spec
/implement DEVOPS-1234 → executes plan + validates manifests + stages diff
Rule: never run
/implementwithout an approved plan in_plans/.
1. Start a task
/specs DEVOPS-1234 add microservice-c with a /health endpoint
Copilot creates branch DEVOPS-1234 from main and writes _specs/DEVOPS-1234.md. Review the spec and edit any section if something is wrong or missing.
2. Generate the plan
/plan DEVOPS-1234
Copilot reads the spec, analyses the codebase, and writes _plans/DEVOPS-1234.md listing every file to create/modify, ordered steps, and validation checks. Review the plan and approve or request changes before proceeding.
3. Implement
/implement DEVOPS-1234
Copilot executes every step in the plan, runs kubectl kustomize on all touched paths, and stages the diff. Once kustomize validation passes, commit:
git add . && git commit -m "feat: add microservice-c (DEVOPS-1234)"/specsaborts if branchDEVOPS-1234already exists locally or remotely/implementaborts if_plans/DEVOPS-1234.mddoes not exist/implementwarns if the branch already has commits ahead ofmain/implementblocks the commit suggestion if anykustomize buildfails
_specs/ ← spec files (source of truth for what to build)
_plans/ ← plan files (auto-generated, reviewed before implementing)
MIT License - use freely!