A production-ready GitOps blueprint for Kubernetes using ArgoCD, Helm, Kustomize, and GitHub Actions. Includes a sample microservices application with CI/CD, monitoring, and multi-environment deployments.
┌─────────────────┐
│ Developer │
│ Git Push │
└────────┬────────┘
│
▼
┌─────────────────┐
│ GitHub Actions │
│ CI Pipeline │
│ - Build │
│ - Test │
│ - Scan │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Container │
│ Registry │
│ (Docker Hub/ │
│ GHCR) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ ArgoCD │
│ - Sync │
│ - Monitor │
│ - Self-Heal │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Kubernetes │
│ Cluster │
│ - API Service │
│ - Worker │
│ - Redis │
│ - Monitoring │
└─────────────────┘
First, ensure ArgoCD is installed in your cluster:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Apply the project definitions:
kubectl apply -f argocd/projects/microservices.yaml
kubectl apply -f argocd/projects/monitoring.yaml
Deploy the root application that manages all other applications:
kubectl apply -f argocd/app-of-apps.yaml
ArgoCD will automatically discover and sync all applications defined in the applications/ directory.
Watch the ArgoCD applications:
kubectl get applications -n argocd
argocd app list
Access ArgoCD UI:
kubectl port-forward svc/argocd-server -n argocd 8080:443
# Open https://localhost:8080 (admin password from argocd-initial-admin-secret)
kubernetes-gitops-blueprint/
├── README.md # This file
├── LICENSE # MIT License
├── .gitignore # Git ignore rules
├── argocd/ # ArgoCD configuration
│ ├── app-of-apps.yaml # Root application (app-of-apps pattern)
│ ├── projects/ # ArgoCD project definitions
│ │ ├── microservices.yaml
│ │ └── monitoring.yaml
│ └── applications/ # Individual application manifests
│ ├── api-service.yaml
│ ├── worker-service.yaml
│ ├── redis.yaml
│ └── monitoring-stack.yaml
├── helm-charts/ # Helm charts for services
│ ├── api-service/ # API service chart
│ ├── worker-service/ # Worker service chart
│ └── redis/ # Redis chart
├── kustomize/ # Kustomize configurations
│ ├── base/ # Base configuration
│ └── overlays/ # Environment-specific overlays
│ ├── dev/
│ ├── staging/
│ └── prod/
├── monitoring/ # Monitoring stack configs
│ ├── prometheus/ # Prometheus configuration
│ └── grafana/ # Grafana dashboards and configs
└── .github/
└── workflows/ # GitHub Actions workflows
├── ci.yml # CI pipeline
└── release.yml # Release pipeline
This blueprint uses Kustomize overlays to manage different environments:
kubectl apply -k kustomize/overlays/dev
kubectl apply -k kustomize/overlays/staging
kubectl apply -k kustomize/overlays/prod
Prometheus is configured to scrape metrics from all services. Access the Prometheus UI:
kubectl port-forward svc/prometheus-server -n monitoring 9090:80
Grafana dashboards are automatically provisioned. Access Grafana:
kubectl port-forward svc/grafana -n monitoring 3000:80
# Default credentials: admin/admin
Pre-configured dashboards:
Prometheus alerting rules are defined in monitoring/prometheus/rules/alerts.yaml. Alerts include:
Customize deployments by modifying values in helm-charts/*/values.yaml:
Applications are configured with automated sync policies:
To disable auto-sync for production, modify the sync policy in the application manifest.
Contributions are welcome! Please follow these steps:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
If you find this useful, consider buying me a coffee!