Skip to content

Cilium

Cilium is the eBPF-based CNI for every cluster in the platform. It provides pod networking, kube-proxy replacement, Gateway API support, L2 load-balancer announcements, and network observability via Hubble.

Overview

Cilium is installed twice, in two different layers:

  1. Terraform bootstrap (terraform/environments/hetzner-mgmt-cluster/2-components/main.tf) installs a minimal Cilium release directly via the Helm provider, before Flux exists. Talos nodes have no CNI and no kube-proxy, so the cluster can't schedule anything — including Flux itself — until Cilium is running.
  2. GitOps takeover — once Flux is bootstrapped, the cilium-config Flux Kustomization applies the full HelmRelease from components/cilium-config/, targeting the same cilium release name/namespace. Helm reconciles in place and Flux becomes the source of truth for all subsequent changes.

Cluster DNS is CoreDNS, which Talos installs; how its replicas are kept on different nodes is in CoreDNS.

Dependencies

Dependency Why
Gateway API CRDs (gateway-api-crds Kustomization) gatewayAPI.enabled requires the CRDs to exist first
MetalLB (metallb-config Kustomization) L2 announcements need MetalLB's IPAddressPool/L2Advertisement in place

The cilium-config Kustomization declares both as dependsOn.

Exposed Services

Service Purpose
Hubble Relay Aggregates flow data from all Cilium agents
Hubble UI In-cluster visualization of network flows (no external route by default)

Repository Layout

components/cilium-config/
├── helmrepository.yaml   # HelmRepository pointing at https://helm.cilium.io/
├── helmrelease.yaml      # HelmRelease with cluster-agnostic defaults
└── kustomization.yaml

components/cilium-config/helmrelease.yaml holds the defaults every cluster shares: kube-proxy replacement, ipam.mode: kubernetes, Hubble enabled, and Gateway API/L7 proxy/L2 announcements disabled. Per the cluster-specific values convention, these feature flags and the k8sServiceHost/cluster.name/cluster.id fields are enabled or overridden per cluster rather than hardcoded in the component.

Cluster wiring

Each cluster/<name>/cilium/kustomization.yaml is a Flux Kustomization pointing at ./components/cilium-config, with a strategic-merge patch turning on the cluster's networking mode:

# cluster/hetzner-mgmt/cilium/kustomization.yaml
patches:
  - patch: |-
      apiVersion: helm.toolkit.fluxcd.io/v2
      kind: HelmRelease
      metadata:
        name: cilium
        namespace: kube-system
      spec:
        values:
          upgradeCompatibility: "1.18"
          cluster:
            name: "hetzner-mgmt"
          l7Proxy: true
          gatewayAPI:
            enabled: true
          l2announcements:
            enabled: true
      target:
        kind: HelmRelease
        name: cilium

Safe Change Workflow

  • Chart version bumps: edit chart.spec.version in components/cilium-config/helmrelease.yaml. This affects every cluster — check the Cilium upgrade notes for breaking changes before bumping, and watch the HelmRelease's remediation.strategy: rollback behavior if the upgrade fails health checks. Helm waits (timeout 10m) for the cilium and cilium-envoy DaemonSets and the cilium-operator, hubble-relay and hubble-ui Deployments to become ready, so a rollout whose agents do not come up fails the upgrade and triggers the rollback; never set disableWait, or a crash-looping upgrade reports Helm upgrade succeeded. The cilium-config Kustomization's timeout (20m) covers that wait plus a rollback.
  • Gateway API CRD bumps (components/gateway-system/crds/): the CRDs must fit the Cilium that runs now, not only the next one. cilium-operator checks a fixed list of Gateway API kinds and versions at startup (requiredGVKs/optionalGVKs, in operator/pkg/gateway-api/cell.go up to 1.19, operator/pkg/gateway-api/helpers/schemes.go from 1.20). It matches the version name in the CRD and ignores whether it is served. So Cilium 1.19 breaks on the v1.5+ standard tlsroutes CRD, which lists v1alpha2 as not served, while Cilium 1.20 requires TLSRoute, ReferenceGrant and BackendTLSPolicy v1 (cilium/cilium#45139). Since v1.5 the bundle also installs the safe-upgrades.gateway.networking.k8s.io ValidatingAdmissionPolicy, which denies any Gateway API CRD whose bundle-version is v1.5.x or older, or that is experimental on top of standard. A Git revert to an older bundle therefore fails until a pull request drops the policy and its binding first.
  • TLSRoute: Cilium 1.20 needs the standard tlsroutes CRD (v1 only), so components/gateway-system/crds/ installs the whole v1.6.3 bundle. Until 1.20, a delete patch kept it out, because the 1.19 operator does not start its Gateway API controller next to it (see above). webshop kept the same patch in cluster/webshop/gateway-system/kustomization.yaml while it stepped up from 1.17, and its 1.20 step dropped it, so both clusters now install the whole bundle. A Helm rollback of Cilium to 1.19 therefore leaves the gateway controller down; the way back is a Git revert of both the chart bump and the CRD change, which prunes the tlsroutes CRD (check kubectl --context <context> get tlsroutes -A is empty first).
  • upgradeCompatibility: set per cluster to the Cilium minor the cluster was first installed with ("1.18" on hetzner-mgmt and "1.17" on webshop, from their Terraform bootstraps), as the Cilium upgrade guide asks. The chart then keeps that release's defaults where a later one changed them; from 1.20 it keeps Envoy on the split xDS mode instead of the new ads. Never raise it as part of a chart bump: a changed default is a change of its own. The hetzner-mgmt Terraform bootstrap now installs 1.20.2, so a rebuilt hetzner-mgmt cluster starts on 1.20 defaults (envoy-xds-mode: ads); set its upgradeCompatibility to "1.20" in the same change as the rebuild, or Flux's first reconcile switches the new cluster's Envoy back to split. The running cluster keeps "1.18".
  • Socket LB is off (bpf-lb-sock: "false" in the cilium-config ConfigMap). From Cilium 1.20 a pod's connection to a NodePort service through a node address (<node IP>:<nodePort>) is load-balanced as it leaves the pod (cilium/cilium#44507): the pod's egress policy must allow the service's backends, and the backends' ingress policy must allow the pod. Nothing here connects that way today: the only NodePorts belong to the LoadBalancer services cilium-gateway-shared-gateway and gitea-ssh, which pods reach through the floating IP.
  • bpf.masquerade on webshop is off: Talos forwards cluster DNS to its host resolver at 169.254.116.108 (forwardKubeDNSToHost, on by default for clusters installed with Talos 1.8 or later), and with BPF masquerading Cilium drops CoreDNS's packets to it (drop (FIB lookup failed)), so no pod resolves anything and Flux can no longer fetch Git — see the Talos Cilium guide, known issues, and the 2026-10-27 incident. The webshop patch therefore sets bpf.masquerade: false. Check pod DNS on a new Talos cluster before it takes the component's bpf.masquerade: true.
  • A values change can leave the agents on the old config: the component does not set rollOutCiliumPods, so a change that only alters the cilium-config ConfigMap (e.g. bpf.masquerade) gets a deployed Helm revision and a Ready HelmRelease while the running agents keep their old settings. Check the agent with kubectl --context <context> -n kube-system exec ds/cilium -c cilium-agent -- cilium-dbg status. If it still shows the old setting, delete the agent pods one node at a time (kubectl --context <context> -n kube-system delete pod <cilium-pod>) and wait for each to be Ready, as in the 2026-10-27 recovery.
  • Shared defaults (e.g. Hubble metrics, bpf.masquerade, policyEnforcementMode): edit values in components/cilium-config/helmrelease.yaml directly — these apply to all clusters.
  • Per-cluster behavior (enabling Gateway API, L2 announcements, L7 proxy, or changing k8sServiceHost/cluster.name/cluster.id): add or edit the patches block in that cluster's cluster/<name>/cilium/kustomization.yaml. Never hardcode a cluster-specific value in the component.
  • Because Cilium also exists outside GitOps (the Terraform bootstrap install), a chart version bump that changes CRDs or requires a specific upgrade path should also be reflected in the hardcoded version in terraform/environments/hetzner-mgmt-cluster/2-components/main.tf if a new cluster would otherwise bootstrap with a stale version before Flux takes over. Cilium only tests upgrades between consecutive minors, so keep that pin on the minor Flux runs (today 1.20.2). Changing the pin never needs an apply on the running cluster: Flux owns the release there.
  • After merging, confirm the cilium-config Kustomization and the cilium HelmRelease report Ready (flux --context <context> get kustomizations, flux --context <context> get helmreleases -n kube-system) before considering the change deployed — a failed Cilium upgrade can take down pod networking cluster-wide. The component runs on every cluster, so check each one, with its kubeconfig context in place of <context> (rules of engagement, rule 8).