A production-ready GitOps infrastructure repository for deploying and managing Kubernetes applications using ArgoCD. This repository contains declarative configurations for automated deployment, monitoring, and load balancing of containerized applications.
- Automated Deployment: Continuous deployment with ArgoCD's GitOps methodology
- Self-Healing Applications: Automatic synchronization and recovery of application state
- Declarative Configuration: Infrastructure and applications defined as code
- Multi-Application Management: Centralized control of multiple services
- Static IP Assignment: LoadBalancer with fixed IP (10.10.90.51) for ArgoCD server
- Prometheus Integration: Metrics collection and alerting with kube-prometheus-stack
- Grafana Dashboards: Visual monitoring and analytics interface
- Alertmanager: Intelligent alert routing and notification management
- Custom Scrape Configs: Monitor external hosts (K3s control plane at 10.10.90.151:9100)
- LoadBalancer Access: Grafana accessible via static IP (10.10.90.50)
- MetalLB Integration: Bare-metal load balancer for on-premises Kubernetes
- IP Address Pool: Dedicated IP range (10.10.90.30-10.10.90.140)
- L2 Advertisement: Layer 2 networking for seamless service exposure
- Static IP Assignment: Predictable service endpoints for external access
- High Availability: Dual deployment strategy (primary + backup)
- Horizontal Pod Autoscaling: Auto-scaling from 2 to 10 replicas based on CPU utilization (50% threshold)
- Health Checks: Readiness probes for zero-downtime deployments
- Resource Management: Defined CPU and memory limits for optimal performance
- LoadBalancer Service: External access via static IP (10.10.90.52)
- Kubernetes Cluster (K3s, K8s, or any Kubernetes distribution)
- kubectl - Kubernetes command-line tool
- ArgoCD - GitOps continuous delivery tool
- Git - Version control system
- MetalLB (optional) - For bare-metal load balancing
- Clone the repository
git clone https://github.com/TropoMetrics/ArgoCI-CD.git
cd ArgoCI-CD- Create required namespaces
kubectl apply -f namespaces/argocd-ns.yaml
kubectl apply -f namespaces/metallb-ns.yaml- Install ArgoCD (if not already installed)
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml- Apply ArgoCD static LoadBalancer service
kubectl apply -f argocd-static- Install MetalLB (for bare-metal clusters)
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.12/config/manifests/metallb-native.yaml
kubectl apply -f metallb/metallb-conf.yaml- Get ArgoCD admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d- Access ArgoCD UI
- Navigate to
http://10.10.90.51orhttps://10.10.90.51 - Username:
admin - Password: (from step 6)
- Navigate to
kubectl apply -f automator.yamlkubectl apply -f monitoring-app.yamlArgoCD will automatically sync and deploy the applications from this repository.
- Kubernetes - Container orchestration platform
- ArgoCD - GitOps continuous delivery tool
- MetalLB - Bare-metal load balancer
- K3s - Lightweight Kubernetes distribution
- Prometheus - Metrics collection and alerting
- Grafana - Visualization and analytics platform
- Alertmanager - Alert routing and management
- kube-prometheus-stack - Complete monitoring solution (v61.3.0)
- Node Exporter - Hardware and OS metrics exporter
- Helm - Kubernetes package manager
- HorizontalPodAutoscaler - Automatic pod scaling
- Docker - Container runtime
ArgoCI-CD/
├── argocd-static # ArgoCD LoadBalancer service configuration
├── automator.yaml # ArgoCD application for weather service
├── monitoring-app.yaml # ArgoCD application for monitoring stack
├── metallb/
│ └── metallb-conf.yaml # MetalLB configuration with IP pool
├── monitoring/
│ ├── Chart.yaml # Helm chart for monitoring stack
│ └── values.yaml # Prometheus, Grafana, Alertmanager config
├── namespaces/
│ ├── argocd-ns.yaml # ArgoCD namespace
│ └── metallb-ns.yaml # MetalLB namespace
├── weerservice/
│ ├── deployment.yaml # Weather service deployments & HPA
│ └── service.yaml # LoadBalancer service
└── README.md # This file
The infrastructure uses the following static IP assignments:
| Service | IP Address | Port | Purpose |
|---|---|---|---|
| ArgoCD Server | 10.10.90.51 | 80, 443 | GitOps management UI |
| Grafana | 10.10.90.50 | 80 | Monitoring dashboards |
| Weather Service | 10.10.90.52 | 80 | Weather application API |
| IP Pool Range | 10.10.90.30-140 | - | Available LoadBalancer IPs |
Edit metallb/metallb-conf.yaml to adjust the IP address pool:
spec:
addresses:
- 10.10.90.30-10.10.90.140 # Your IP range- URL:
http://10.10.90.50 - Username:
admin - Password:
prom-operator
Add additional scrape targets in monitoring/values.yaml:
additionalScrapeConfigs:
- job_name: 'custom-target'
scrape_interval: 15s
static_configs:
- targets: ['<host>:<port>']
labels:
nodename: 'custom-node'Adjust autoscaling parameters in weerservice/deployment.yaml:
spec:
minReplicas: 2 # Minimum pods
maxReplicas: 10 # Maximum pods
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50 # Scale at 50% CPU- Node Metrics: CPU, memory, disk, network from K3s control plane
- Application Metrics: Weather service performance and health
- Kubernetes Metrics: Cluster state, pod status, resource utilization
- Custom Scrapes: External host monitoring (10.10.90.151:9100)
Alerts are configured with the following defaults:
- Group Wait: 30s
- Group Interval: 5m
- Repeat Interval: 12h
- Resolve Timeout: 5m
Customize alert routing in monitoring/values.yaml under alertmanager.config.
- Make changes to YAML files in this repository
- Commit and push to the
mainbranch - ArgoCD detects changes automatically
- Auto-sync deploys updates to the cluster
- Self-healing ensures desired state is maintained
argocd app sync weerservice
argocd app sync monitoringargocd app get weerservice
argocd app get monitoring# Check ArgoCD pods
kubectl get pods -n argocd
# Check service
kubectl get svc -n argocd argocd-server
# Verify LoadBalancer IP
kubectl get svc -n argocd argocd-server -o jsonpath='{.status.loadBalancer.ingress[0].ip}'# Check MetalLB pods
kubectl get pods -n metallb-system
# Verify IP pool
kubectl get ipaddresspool -n metallb-system
# Check L2 advertisement
kubectl get l2advertisement -n metallb-system# View sync status
argocd app get <app-name>
# Check logs
kubectl logs -n argocd <argocd-application-controller-pod>
# Force refresh
argocd app sync <app-name> --force# Check pods
kubectl get pods -l app=weerservice
# Check HPA status
kubectl get hpa weerservice-hpa
# View pod logs
kubectl logs <pod-name>
# Check service
kubectl get svc weerserviceContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature- Commit your changes
git commit -m 'Add some amazing feature'- Push to the branch
git push origin feature/amazing-feature- Open a Pull Request
- Follow Kubernetes best practices
- Use declarative YAML configurations
- Test changes in a development cluster first
- Document IP address changes
- Keep ArgoCD applications in sync
- Use meaningful commit messages
- ArgoCD Documentation
- Kubernetes Documentation
- MetalLB Documentation
- Prometheus Operator
- Grafana Documentation
This project is for educational purposes.
Authors: Max Blaauw, Arne Jansonius, Kai Diemel & Ole Spiegelenberg Organization: HHS (The Hague University of Applied Sciences) Domain: hhs.nl