Production-ready Kubernetes infrastructure managed through GitOps principles with comprehensive observability
This repository serves as the single source of truth for the entire platform infrastructure. It defines the desired state of all Kubernetes resources and is automatically reconciled by Argo CD. All changes to the cluster are driven exclusively through Git commitsβno manual kubectl apply commands.
- Philosophy & Purpose
- Repository Structure
- Technology Stack
- Helm Charts
- GitOps with Argo CD
- Observability Stack
- Local Setup Guide
- CI/CD Integration
- Security & Best Practices
- Troubleshooting
- Cleanup & Reset
"What should be running in the cluster right now?"
This repository provides the definitive answer through declarative configuration.
β
Git as Single Source of Truth
β
Declarative Infrastructure
β
Automated Reconciliation
β
Immutable Deployments
β
Auditable Change History
β
Self-Healing Capabilities
- Separation of Concerns: Application code lives in
platformrepository - Environment Parity: Same patterns work across dev, staging, and production
- Disposable Infrastructure: Clusters can be recreated from scratch in minutes
- Progressive Delivery: Controlled rollouts with automated rollback capabilities
- Observability First: Built-in monitoring, metrics, and visualization
platform-ops/
β
βββ helm/ # Helm charts for all services
β βββ api-node/
β β βββ Chart.yaml # Chart metadata
β β βββ values.yaml # Default configuration
β β βββ templates/ # Kubernetes manifests
β β βββ deployment.yaml
β β βββ service.yaml
β β βββ ingress.yaml
β β βββ hpa.yaml # Horizontal Pod Autoscaler
β β βββ pdb.yaml # Pod Disruption Budget
β β βββ servicemonitor.yaml
β β
β βββ core-go/
β β βββ Chart.yaml
β β βββ values.yaml
β β βββ templates/
β β βββ ...
β β
β βββ worker-python/
β βββ Chart.yaml
β βββ values.yaml
β βββ templates/
β βββ ...
β
βββ argocd/ # Argo CD Application definitions
β βββ api-node.yaml # Application CRD for api-node
β βββ core-go.yaml # Application CRD for core-go
β βββ worker-python.yaml # Application CRD for worker-python
β
βββ observability/ # Monitoring and observability stack
β βββ prometheus/ # Prometheus metrics collection
β β βββ namespace.yaml # Dedicated namespace
β β βββ rbac.yaml # ServiceAccount + ClusterRole
β β βββ configMap.yml # Scrape configs & rules
β β βββ deployment.yaml # Prometheus deployment
β β βββ service.yaml # Prometheus service
β β
β βββ grafana/ # Grafana dashboards
β βββ deployment.yaml # Grafana deployment
β βββ service.yaml # Grafana service
β βββ configmap-dashboards.yaml
β βββ configmap-datasources.yaml
β
βββ ingress/ # Ingress controller (NGINX)
β βββ ingress-nginx.yaml
β
βββ README.md # This file
| Component | Technology | Version | Purpose |
|---|---|---|---|
| Orchestration | Kubernetes | 1.28+ | Container orchestration |
| GitOps | Argo CD | 2.9+ | Continuous deployment |
| Package Manager | Helm | 3.13+ | Templating & versioning |
| Ingress | NGINX Ingress | 1.9+ | External traffic routing |
| Metrics | Prometheus | 2.48+ | Metrics collection |
| Visualization | Grafana | 10.2+ | Dashboards & alerting |
| Container Registry | GHCR | Latest | Image storage |
| Local Cluster | Kind | 0.20+ | Local K8s cluster |
Each service has a dedicated Helm chart following best practices:
helm/service-name/
βββ Chart.yaml # Chart metadata & versioning
βββ values.yaml # Default values (overridable)
βββ values-dev.yaml # Development overrides
βββ values-prod.yaml # Production overrides
βββ templates/
βββ deployment.yaml # Main workload
βββ service.yaml # Service definition
βββ ingress.yaml # External routing
βββ hpa.yaml # Autoscaling config
βββ pdb.yaml # Disruption budget
βββ configmap.yaml # Configuration data
βββ secret.yaml # Sensitive data (sealed)
βββ servicemonitor.yaml # Prometheus scraping- Container specifications
- Resource limits and requests
- Security context (non-root)
- Health probes (liveness/readiness)
- Environment variables
- Volume mounts
- ClusterIP service type
- Port definitions
- Selector labels
- Session affinity (if needed)
- Path-based routing
- TLS termination
- SSL certificates
- Rate limiting annotations
- CPU-based scaling
- Memory-based scaling
- Custom metrics (optional)
- Minimum available pods
- Maximum unavailable pods
- High availability guarantees
β
Reusability: Same chart across dev/staging/prod
β
Versioning: Semantic versioning for charts
β
Templating: DRY principle with Go templates
β
Rollback: Built-in rollback capabilities
β
Testing: helm template and helm lint
β
GitOps Compatible: Declarative and deterministic
# values.yaml
replicaCount: 3
image:
repository: ghcr.io/org/api-node
tag: "a1b2c3d"
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 3000
ingress:
enabled: true
className: nginx
hosts:
- host: api.example.com
paths:
- path: /
pathType: Prefix
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
autoscaling:
enabled: true
minReplicas: 3
maxReplicas: 10
targetCPUUtilizationPercentage: 70π GitOps with Argo CD
Argo CD is responsible for continuous reconciliation.
Responsibilities
Watch this repository
Render Helm charts
Apply Kubernetes manifests
Enforce desired state continuously
Enabled Features
Automated sync
Drift correction (self-heal)
Resource pruning
β No kubectl apply is used for application workloads.
π CI β GitOps Image Promotion Flow
This repository does not build images.
Flow
CI builds images in the platform repository
Images are tagged with Git commit SHA
CI updates image.repository and image.tag in Helm values.yaml
Changes are committed to this repository
Argo CD detects the change and deploys automatically
Rollback = Git revert
π Networking
Service-to-service communication via Kubernetes DNS
External access via NGINX Ingress
TLS termination at Ingress (local / self-signed for Kind)
π Security Posture
Containers run as non-root
Read-only root filesystems
Least-privilege security context
No secrets committed to Git
Registry access via imagePullSecrets
π Observability (Manual Prometheus Setup)
Observability is intentionally installed manually (no Helm) to deeply understand Prometheus internals.
What is monitored
Application metrics (/metrics)
HTTP request counters and latency
Background worker metrics
What is NOT included (yet)
node-exporter
kube-state-metrics
Alertmanager
π Prometheus Architecture (Manual)
Prometheus is deployed as a Deployment and discovers applications using:
Kubernetes API
kubernetes_sd_configs
Label-based relabeling
Prometheus pulls metrics from:
api-node
core-go
worker-python
Each application exposes /metrics.
π Prometheus Manifests
Located at:
observability/prometheus/
Includes:
Namespace
ServiceAccount
RBAC
ConfigMap (prometheus.yml)
Deployment
Service
Prometheus runs in the observability namespace and scrapes apps in default.
π Running the Platform Locally (Clean Start) 1οΈβ£ Prerequisites
Docker
Kind
kubectl
GitHub account (GHCR access)
2οΈβ£ Create a Kind Cluster kind create cluster --name kind-cluster-1 kubectl config use-context kind-kind-cluster-1
3οΈβ£ Install Argo CD (Fresh) kubectl create namespace argocd
kubectl apply -n argocd
-f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Verify:
kubectl get pods -n argocd
All pods must be Running, especially argocd-repo-server.
4οΈβ£ Configure GHCR Access (Required)
Create image pull secret:
kubectl create secret docker-registry ghcr-cred
--docker-server=ghcr.io
--docker-username=
--docker-password=
--docker-email=unused@example.com
-n default
Attach to default ServiceAccount:
kubectl patch serviceaccount default
-n default
-p '{"imagePullSecrets":[{"name":"ghcr-cred"}]}'
5οΈβ£ Register Applications in Argo CD kubectl apply -n argocd -f argocd/
Verify:
kubectl get applications -n argocd
Apps should move to:
Synced
Healthy
6οΈβ£ Install Prometheus (Manual) kubectl apply -f observability/prometheus/
Access Prometheus:
kubectl port-forward -n observability svc/prometheus 9090:9090
Open:
Check:
Status β Targets
All app targets should be UP
π§Ή Cleaning the Cluster (Reset Everything) Remove Applications kubectl delete applications -n argocd --all
Remove Workloads kubectl delete namespace default kubectl create namespace default
Remove Prometheus kubectl delete namespace observability
Remove Argo CD (Full Reset) kubectl delete namespace argocd
π§ Design Philosophy
GitOps-first
Immutable images
CI β CD separation
Kubernetes-native patterns
Minimal but production-aligned
Learning-focused observability (manual first, Helm later)
π Related Repository Application Source & CI