Skip to main content

Architecture

High-Level Overview

Component Flow

Directory Structure

k8s-playground-cluster/
├── Makefile # Build/deploy automation
├── build/scripts/
│ ├── bootstrap.sh # Initial cluster setup
│ ├── deploy.sh # Tag-based deployment
│ └── prepare-release.sh # Release management
├── charts/
│ ├── argocd-project/ # ArgoCD AppProject definitions
│ ├── gatekeeper-policies/ # OPA Gatekeeper policies
│ ├── namespace-manager/ # Sample user application
│ ├── pi-hole/ # Pi-hole Helm chart
│ └── system-apps/ # System app ArgoCD templates
├── cluster/
│ ├── dev/
│ │ ├── config.yaml # Dev environment config
│ │ ├── argocd-values.yaml # ArgoCD Helm values
│ │ └── application/ # Dev-specific application configs
│ └── qa/
│ └── config.yaml # QA environment config
└── config/
├── dev/applications/ # Dev app-specific values files
└── qa/applications/ # QA app-specific values files

Deployment Architecture

GitOps Flow

  1. Developer commits changes to Git repository
  2. ArgoCD detects changes (via polling or webhook)
  3. ArgoCD renders Helm templates with environment values
  4. ArgoCD applies manifests to Kubernetes cluster
  5. Kubernetes schedules and runs workloads
  6. System components (cert-manager, external-dns) react to new resources

Sync Waves

ArgoCD syncs applications in order using annotations:

WaveComponentsDescription
-1ArgoCD, AppProjectSelf-managing, must exist first
0local-path-provisioner, namespace-managerStorage and namespace setup
1cert-manager, MetalLB, NGINX Ingress, External-DNSCore infrastructure and networking
2istio-baseIstio CRDs (must be before istiod)
3istiod, loki, kube-prometheus-stack, cluster-configsService mesh control plane, monitoring
4grafana-alloy, promtailLog collectors
5gatekeeperOPA Gatekeeper admission controller
6gatekeeper-policiesOPA policies (ConstraintTemplates, Constraints)
7sealed-secretsSecret encryption for GitOps
8User applicationsApplication workloads

Multi-Environment Support

This setup supports multiple environments (dev, qa):

cluster/dev/config.yaml     → clusterEnv: dev
cluster/qa/config.yaml → clusterEnv: qa

Currently, the dev environment is fully configured with all components, while qa has a minimal setup with core infrastructure only.

The environment configuration includes:

  • config.yaml with enabled/disabled apps and versions
  • App-specific values in config/dev/applications/
  • ArgoCD sync and deployment configuration

Component Details

Core Infrastructure

ComponentPurposeNamespace
ArgoCDGitOps controllerargocd
cert-managerTLS certificate automationcert-manager
MetalLBLoadBalancer providermetallb-system

Networking

ComponentPurposeNamespace
NGINX IngressHTTP/HTTPS routingingress-nginx
External-DNSDNS record automationexternal-dns

Storage

ComponentPurposeNamespace
local-path-provisionerDynamic PVC provisioninglocal-path-storage

Observability

ComponentPurposeNamespace
kube-prometheus-stackMetrics and alertingmonitoring
LokiLog aggregationmonitoring
Grafana AlloyUnified observability collectormonitoring

Service Mesh & Security

ComponentPurposeNamespace
IstioService mesh (traffic, security, observability)istio-system
OPA GatekeeperPolicy engine (admission control, audit)gatekeeper-system
Sealed SecretsSecret encryption for GitOpskube-system
cluster-configsCluster-wide ConfigMaps and tuningvarious

Applications

ComponentPurposeNamespace
Pi-holeNetwork ad-blockingpihole
namespace-managerSample user applicationdefault

Network Flow

Security Boundaries

  • Network Policies: Calico provides pod-to-pod network segmentation
  • TLS: All ingress traffic encrypted via cert-manager + Let's Encrypt
  • RBAC: Kubernetes role-based access control for all components
  • GitOps: All changes audited via Git history