Skip to content

Flagger

Flagger and flagger-loadtester in namespace flagger-system, for the shops' blue/green rollouts on the webshop cluster. Why and what it costs: ADR 0025.

Where Holds
components/flagger/ Namespace, HelmRepository, the HelmReleases flagger (with its CRDs) and flagger-loadtester, the loadtester's NetworkPolicy
components/flagger/tests/ The smoke test: two podinfo Canaries in the scratch namespace flagger-test. Not applied by Flux
cluster/webshop/flagger/ Flux Kustomization flagger, after prometheus-stack

Using it from a shop

  • Set provider: kubernetes on the Canary. Flagger takes over the Deployment: <name>-primary serves the <name> Service, and the new version runs behind <name>-canary during the analysis.
  • Query metrics through a MetricTemplate with provider.type: prometheus and address http://monitoring-kube-prometheus-prometheus.monitoring:9090. Built-in metrics (request-success-rate, request-duration) find no data here; see the ADR.
  • Select the canary pods with pod=~"{{ target }}-[0-9a-z]+-[0-9a-z]+", which leaves out <target>-primary-*.
  • Webhooks go to http://flagger-loadtester.flagger-system/. Only Flagger may reach it.
  • A shop's Flux Kustomization depends on flagger, which brings the Canary and MetricTemplate CRDs.

Smoke test

components/flagger/tests/smoke-test.sh --context webshop

It applies tests/, waits until both Canaries are Initialized, changes their pod templates, and waits for promote to reach Succeeded and rollback to reach Failed. The rollback Canary's load test calls /status/500, so its success rate is near 0. The script prints the Canary events with Flagger's reasons, then deletes the test Canaries, Deployments, MetricTemplate and PodMonitor while retaining flagger-test for reuse on the next run. Flagger garbage-collects each Canary’s primary Deployment and Service. It ends with PASS or FAIL and the matching exit code. Run it after a Flagger upgrade, too.

Last passed on 2026-10-30 on webshop (Taskbase #2030) in about 10 minutes: the apply printed no PodSecurity warnings, and flagger-test remained, empty, after cleanup. A run takes longer than a 10-minute command timeout, so an agent runs it in the background and polls; a killed run skips the cleanup, so run the trap's delete by hand before the next run.

The first pass, on 2026-10-28 (Taskbase #2020), came about 30 minutes after install. The analysis ran from 18:48:58Z to 18:57:52Z. promote advanced through iterations 1–3 and ended with Promotion completed!. rollback also advanced through iterations 1–3, then was halted three times with success-rate 1.75 < 99 and rolled back with failed checks threshold reached 3. So in a blue/green analysis a failing check stops the rollout before promotion, not at the first iteration.

Resource use

Measured on 2026-10-28 (Taskbase #2020) during and after the smoke test, against the requests and limits of ADR 0025:

Pod Working set, now / max 30m CPU, 5m rate / max 1m rate Requests Limits
flagger 16Mi / 20Mi 11m / 12m 10m, 32Mi 200m, 128Mi
flagger-loadtester 16Mi / 30Mi 13m / 17m 10m, 64Mi 500m, 256Mi

Memory stays under the requests, and CPU is slightly above its 10m request but far under the limits. The Metrics API is not installed on webshop, so kubectl top does not work. Query Prometheus instead, for example container_memory_working_set_bytes{namespace="flagger-system"}.