Kubernetes Deployment#

Added in v0.5. Ships as a Helm chart at deploy/helm/infraguard/ in the repo. Deploys the proxy, the dashboard, and (optionally) Redis for cluster-wide shared state, along with a HorizontalPodAutoscaler that scales the proxy on the infraguard_active_beacons custom metric.

Quick start#

# From the repo root
helm install ig deploy/helm/infraguard \
  --set image.tag=0.5.0 \
  --set-file config.contents=./my-config.yaml \
  --set secrets.data.INFRAGUARD_API_TOKEN=$(openssl rand -hex 32)

Pods:

kubectl get pods -l app.kubernetes.io/instance=ig
NAME                    READY   STATUS    RESTARTS   AGE
ig-infraguard-proxy-0   1/1     Running   0          20s
ig-infraguard-dashboard 1/1     Running   0          20s
ig-infraguard-redis-0   1/1     Running   0          20s

Chart layout#

deploy/helm/infraguard/
├── Chart.yaml
├── values.yaml
└── templates/
    ├── _helpers.tpl
    ├── configmap.yaml          # config.yaml contents
    ├── secret.yaml             # INFRAGUARD_API_TOKEN, LE email, cloud creds
    ├── deployment-proxy.yaml   # HTTPS + QUIC + embedded API
    ├── deployment-dashboard.yaml
    ├── service.yaml            # proxy 443/TCP + 443/UDP, dashboard 8080/TCP
    ├── redis.yaml              # StatefulSet + headless Service
    ├── ingress.yaml            # optional
    ├── hpa.yaml                # optional, gates on active-beacons
    ├── servicemonitor.yaml     # optional, Prometheus Operator CRD
    └── NOTES.txt

Custom metric autoscaling#

Set autoscaling.enabled=true in values. The HPA scales the proxy Deployment on the infraguard_active_beacons gauge (added in v0.5):

autoscaling:
  enabled: true
  minReplicas: 1
  maxReplicas: 10
  targetBeaconsPerReplica: 50
  cpuUtilization: 80
  memoryUtilization: 80

The chart’s HPA references infraguard_active_beacons through the Custom Metrics API. That means you need a prometheus-adapter (or equivalent) installed in the cluster that scrapes InfraGuard’s /metrics and republishes the gauge:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus-adapter prometheus-community/prometheus-adapter \
     --set prometheus.url=http://prometheus-operated.monitoring.svc

Without an adapter the HPA sits in unable to fetch metric and never scales.

Shared state via Redis#

values.yaml defaults to redis.enabled: true. The Redis StatefulSet backs the shared replay cache, circuit-breaker state, dynamic whitelist, beacon session bag, and drop rate-limit added in v0.5. Turn it off with --set redis.enabled=false if you want the single-node in-memory backend.

The chart wires the connection string automatically. Manual overrides are in the config.contents block under state:.

Observability#

Set serviceMonitor.enabled=true if you run the Prometheus Operator. That renders a ServiceMonitor pointing at the dashboard’s /metrics endpoint. Otherwise scrape yourself:

kubectl port-forward svc/ig-infraguard-dashboard 8080:8080
curl http://localhost:8080/metrics

Import deploy/grafana/infraguard.json into your Grafana as described in grafana.

Rolling updates#

helm upgrade ig deploy/helm/infraguard --set image.tag=0.5.1

The chart annotates the pod template with a checksum of the rendered ConfigMap so a config change forces a rollout, not just a hot-reload.

Deleting the release#

helm uninstall ig
kubectl delete pvc -l app.kubernetes.io/instance=ig    # removes Redis data

Probes need HTTPS#

The proxy binds HTTPS on 443 whenever any listeners[] entry has a tls: block; the dashboard auto-enables HTTPS on 8080 whenever that same condition is true. The chart’s livenessProbe and readinessProbe therefore use scheme: HTTPS; changing the config to run plain HTTP means the probes need scheme: HTTP too or they return 401/EOF.

The proxy’s probe hits its own /health on the https container port (443) rather than the api port (8080). Port 8080 mounts the dashboard, and its AuthMiddleware returns 401 for every path except /, /api/auth/login, and /api/auth/check.

Config-history git#

The dashboard writes every mutation (drop-action, plugin toggle, profile swap) to a git repo under INFRAGUARD_CONFIG_HISTORY. The chart defaults that env var to /app/data/config-history.git so it lands on the writable data volume, and the runtime image now ships git for the commits to succeed. Point it elsewhere with extraEnv to move the audit trail to a shared volume across replicas.

Self-signed cert location#

Every replica generates its own self-signed fallback cert on the tmpfs the chart mounts at /app/.infraguard. The proxy honors the INFRAGUARD_SELF_SIGNED_DIR env var if you want to point it elsewhere (for example a PVC to keep certs stable across restarts, though for a burn-and-replace redirector that usually is not needed).