Skip to content

0025 - Flagger with Provider kubernetes for the Webshops' Blue/Green Rollouts

Status

Proposed 2026-10-28 in Taskbase task #2009 (roadmap E0.4 "Platform-ADR og Flagger" of eloro/webshop-platform docs/design/07-roadmap.md). Built in the same pull request: components/flagger/ and cluster/webshop/flagger/.

Date

2026-10-28

Context

The shops on the webshop cluster (cluster/webshop/, one cx33 node, 4 vCPU / 8 GB) are released with blue/green rollouts that a metric check promotes or rolls back without a person (eloro/webshop-platform docs/design/09-own-cluster.md §6.1 and design 06 §6.3). The shop chart already ships a Flagger Canary, the RED metrics shop_http_requests_total and shop_http_request_duration_seconds, and selftest and load-test webhooks. The platform has to supply the controller that acts on them.

Constraints:

  • No service mesh and no traffic-splitting ingress. Traffic enters through the Cilium Gateway; adding Istio, Linkerd or similar to one node is out of budget.
  • One node. Every pod has requests and limits; system parts share ≈ 3.6–4.2 GiB, and the whole node stays under 80 % of allocatable memory with the demo shop (design 09 §3.3, §6.1).
  • Metrics stay on the cluster. The webshop Prometheus (cluster/webshop/prometheus-stack/, task #2008) has no remote-write, so a rollout can be judged while hetzner-mgmt is down.

Options considered

  • Flagger, provider kubernetes — blue/green through ClusterIP Services; analysis by Prometheus queries; the shop chart's Canary already targets it.
  • Flagger, provider gatewayapi:v1 — weighted canary through HTTPRoutes on the Cilium Gateway; progressive traffic, but needs Gateway API weight support tested on Cilium and doubles the routing work for a one-replica shop.
  • Argo Rollouts — similar analysis model, but its own Rollout kind replaces the shop's Deployment, and the shop chart would have to be rewritten.
  • No controller — a CI job compares metrics and switches Services; no automatic rollback once CI is gone, and it reinvents Flagger.

Decision

Chosen option: Flagger, provider kubernetes, because it needs no mesh or routing change, works with the shop chart as it is, and costs about 0.1 GiB.

  • Install: components/flagger/: the flagger chart 1.45.0 and the loadtester chart 0.39.0 (both Apache-2.0, https://flagger.app) in namespace flagger-system, meshProvider: kubernetes. Renovate's flux manager tracks both chart versions. The chart's CRDs (Canary, MetricTemplate, AlertProvider) are applied by Flux with crds: CreateReplace.
  • Rollout model: for a Canary with provider: kubernetes, Flagger copies the shop's Deployment to <name>-primary, which serves the <name> Service. A new pod template scales up the canary Deployment behind <name>-canary, runs the analysis for iterations intervals, and then copies the template to the primary (promote) or scales the canary to zero (roll back) once threshold checks have failed. No traffic is shifted: real users see the new version only after promotion.
  • Metrics source: the webshop Prometheus, http://monitoring-kube-prometheus-prometheus.monitoring:9090. Flagger's built-in request-success-rate and request-duration do not work here: their queries select kubernetes_namespace and kubernetes_pod_name labels (pkg/metrics/observers/http.go, v1.45.0), which come from annotation-based scraping, while kube-prometheus-stack labels namespace and pod. Every analysis therefore uses MetricTemplates with their own queries, as the shop chart's RED queries do. metricsServer is still set to the same address.
  • Webhooks: the loadtester runs the Canaries' cmd and bash webhooks at http://flagger-loadtester.flagger-system/. It runs any command it is sent, so a NetworkPolicy lets only the Flagger pod reach it; its service account has no RBAC.
  • Resource cost (estimates until measured with the demo shop):
Pod Requests Limits
flagger 10m, 32Mi 200m, 128Mi
flagger-loadtester 10m, 64Mi 500m, 256Mi
Total 20m, 96Mi 700m, 384Mi

This matches the design's ≈ 0.1 GiB and 0.05 CPU. During a rollout a shop runs twice (primary and canary), so the shops' budget must hold one extra shop pod at a time. - Proof: components/flagger/tests/smoke-test.sh applies two podinfo Canarys in the scratch namespace flagger-test, one that promotes and one that serves 5xx and is rolled back, and removes the test resources afterwards while retaining the namespace for reuse.

Consequences

Positive

  • Shops promote or roll back on their own metrics with no person and no mesh.
  • The analysis keeps working when hetzner-mgmt or the internet path is down.

Negative

  • Blue/green only: a bad version is judged on load-test traffic, not on a share of real users.
  • A rollout briefly doubles a shop's pods on the one node.
  • Flagger brings CRDs, so its minor and major upgrades are upgrade/breaking in Renovate's preset terms ("cluster add-ons that bring CRDs"); Helm rollback does not revert them.
  • Built-in metrics cannot be used; every Canary needs a MetricTemplate.