Skip to content

Operations

This page covers the operational side of running this controller once it’s installed: upgrading it safely, what to watch once it’s live, how to read the common failure symptoms, and how to take it out of a cluster cleanly.

  1. Read the release notes for the version you’re moving to. Past releases have added new CRDs — v0.2.0 added the tunnel-policy CRD, and v0.3.0 added the four Access CRDs — so the step below isn’t boilerplate; it’s the step that actually matters most releases.

  2. Apply the new chart’s CRDs before touching the release itself. Helm’s own behavior is the reason this is a separate step: helm upgrade never installs or updates CRDs, on any release, even when the chart’s crds/ directory changed. Pull the target version’s CRDs and apply them server-side — --server-side is good practice here regardless (it tracks field ownership instead of relying on a client-side diff):

    Terminal window
    helm show crds oci://ghcr.io/dreamfuse-labs/charts/cloudflare-gateway-controller --version 0.4.0 \
    | kubectl apply --server-side -f -

    This exact command is verified against an additive CRD change (0.2.0 → 0.3.0, which only added new CRDs). A release that instead changes a field on an existing CRD can hit a server-side-apply ownership conflict, because Helm’s own helm upgrade/helm install path already owns those fields under the helm field manager. If you see a conflict error, add --force-conflicts to the command above — taking ownership of the changed fields is expected and correct in this situation.

  3. Then upgrade the release:

    Terminal window
    helm upgrade cloudflare-gateway-controller oci://ghcr.io/dreamfuse-labs/charts/cloudflare-gateway-controller --version 0.4.0 --namespace cloudflare-gateway-controller-system
  4. Verify. Wait for the rollout, then confirm the objects that depend on this controller’s watches are still Accepted:

    Terminal window
    kubectl rollout status deployment/cloudflare-gateway-controller -n cloudflare-gateway-controller-system
    kubectl get gatewayclass -o custom-columns=NAME:.metadata.name,ACCEPTED:.status.conditions[0].status
    kubectl get cloudflaregatewayconfiguration -o custom-columns=NAME:.metadata.name,ACCEPTED:.status.conditions[0].status

If you skip step 2 on a release that added a CRD: at process startup, before it starts reconciling anything, this controller registers a watch for every custom resource kind it reconciles, including the newly added ones. If the cluster doesn’t have that kind registered yet, the failure mode depends on what that controller’s setup does:

  • If setting it up also registers a field index for that kind (two controllers do this today: one indexes CloudflareTunnelPolicy by its target, the other CloudflareAccessIdentityProvider by its referenced Secret) — the index registration needs an immediate type lookup, which fails synchronously, right there in SetupWithManager. The process exits immediately, before the manager even starts.
  • Otherwise, the plain watch itself doesn’t fail at setup time — controller-runtime retries the type lookup every 10 seconds in the background. The process instead runs for a while (up to the cache-sync timeout, 2 minutes by default) before that watch’s cache fails to sync and mgr.Start gives up.

Either way, the whole controller exits — not degraded, not partially working, not failing only the first time something touches the new feature — and the Pod sits in CrashLoopBackOff until the missing CRD is applied. Nothing is silently skipped; the process simply refuses to stay up. Applying the CRDs (even after the fact, without re-running helm upgrade) is enough on its own to let the next restart succeed.

Upgrading to v0.4.0, which adds tunnel autoscaling and image overrides

Section titled “Upgrading to v0.4.0, which adds tunnel autoscaling and image overrides”

Three things in this release affect every installation, whether or not you turn the new features on.

  • Every existing tunnel rolls once. The release gives each managed cloudflared container resource settings, which changes the pod template, so each tunnel’s Deployment rolls once after helm upgrade. A rollout at the default 2 replicas dropped no requests when tested at about 5 requests per second. A tunnel running a single replica was not tested and may briefly drop requests during the roll.
  • Every cloudflared container now has a memory limit, and this release has no setting to change it. The settings are a 100m CPU request, a 64Mi memory request and a 128Mi memory limit, with no CPU limit. In testing with one client, cloudflared peaked at about 53Mi. A tunnel carrying many concurrent WebSocket or streaming connections was not measured, and Kubernetes kills and restarts a container that exceeds its memory limit. After upgrading, check for restarts: kubectl get pods -A -l app.kubernetes.io/name=cloudflared.
  • Step 2 matters for the new fields. This release adds optional fields to the CloudflareGatewayConfiguration and CloudflareTunnelPolicy CRDs. If the CRDs are not applied first, the API server accepts the object and discards the fields it does not know, so nothing fails and no autoscaler or pull-secret setting ever takes effect. Unlike a missing CRD kind, this does not crash the controller, so nothing alerts you.

The metrics endpoint’s address and authentication are chart values — metrics.bindAddress/metrics.secure and the RBAC metrics.secure: true requires are already covered in Helm Values; this page doesn’t repeat them. The same reference also covers metrics.serviceMonitor.*, the optional Prometheus Operator ServiceMonitor this chart can render for you.

Once the endpoint is reachable, four series are this project’s own, beyond anything controller-runtime registers for free — each a gauge keyed by namespace/name, and each deleted (not just zeroed) once its owning object is gone, so a fleet’s dashboard never accumulates permanent series for objects that no longer exist:

Series Reports
cloudflaretunnel_ready Whether a CloudflareTunnel’s Ready condition is currently True (1) or False (0).
cloudflaretunnel_connector_count How many cloudflared connector connections are currently reported for a CloudflareTunnel.
cloudflarednsrecord_synced Whether a CloudflareDNSRecord’s Synced condition is currently True (1) or False (0).
dns_gateway_ready Whether a DNS-mode Gateway’s derived Cloudflare-side readiness (DNS record sync plus certificate readiness, reported through its owned CloudflareGatewayStatus) is currently True (1) or False (0), keyed by the Gateway’s own namespace/name.

Two more series cover the Cloudflare API calls this controller makes on your behalf, not the Kubernetes-side resources those calls produce:

  • cloudflare_api_request_duration_seconds (a histogram) — latency of every Cloudflare API request, labeled method (the HTTP verb), path (the request path, with any zone/tunnel/ record ID collapsed to a fixed placeholder so the series stays low-cardinality regardless of how many distinct Cloudflare resources a credential ever touches), and status (2xx, 4xx, 5xx, or error for a request that never got a response at all).
  • cloudflare_api_rate_limit_hits_total (a counter) — how many Cloudflare API responses came back 429 Too Many Requests, labeled method and path (same collapsing as above). See RateLimited below for what a hit on this counter means for a specific object.

Beyond these, controller-runtime’s own standard series are already there for free — reconcile counts, reconcile duration, and workqueue depth per controller — the same series any controller-runtime-based project exposes. This page doesn’t re-document those; they’re not specific to this project.

The controller exposes the usual two: /healthz (process liveness) and /readyz, which reports ready only once every informer cache it depends on has finished its initial sync — not merely “the process is alive.” Both bind to healthProbeBindAddress (a chart value, :8081 by default).

Structured JSON by default — the shipped image’s deliberate production default, so logs are straightforward to ship into a log aggregator without a separate parsing step. The chart does not expose a value for passing extra controller arguments today, so there’s no supported way to switch to a human-readable console format (--zap-devel=true) without either patching the chart’s Deployment template directly or applying a Helm post-renderer — not something worth doing for a running deployment; reach for kubectl logs | jq instead if you need to read JSON output by eye.

Every condition below links to its full entry in Conditions, which covers every Reason this project ever sets, not just the ones that show up here.

Symptom: an object (a CloudflareDNSRecord, CloudflareAccessApplication, or similar) never reaches Accepted. Condition: Accepted=False, Reason= InvalidZone. Fix: the zone the object targets isn’t in its resolved CloudflareGatewayConfiguration’s zoneAllowlist — add the zone there, or point the object at a configuration that already allows it.

Symptom: a GatewayClass or another object never reaches Accepted. Condition: Accepted=False, Reason= InvalidParameters. Fix: depends on what the message names — usually a parametersRef/configurationRef that doesn’t resolve, or resolves to something not itself Accepted.

One specific shape of this is expected, not a problem to fix by hand: a GatewayClass applied before the CloudflareGatewayConfiguration its parametersRef names even exists. The GatewayClass reports InvalidParameters immediately (the reference can’t resolve yet), but this controller watches every CloudflareGatewayConfiguration for exactly this reason (v0.3.0 and later — on an earlier version, restart the controller to force re-evaluation instead) — once the configuration is created and itself becomes Accepted, the GatewayClass is automatically re-evaluated and flips to Accepted with no further action. Give it a few seconds after creating the configuration before assuming something is actually stuck; if it’s still InvalidParameters after the configuration itself reports Accepted=True, re-check the parametersRef’s group/kind/name for a typo instead.

A GRPCRoute returns 403 from Cloudflare’s edge, never reaching your backend at all

Section titled “A GRPCRoute returns 403 from Cloudflare’s edge, never reaching your backend at all”

This is a zone-level setting, not a routing bug — see the third requirement in Routing’s GRPCRoute section for the full explanation (the zone’s gRPC network feature has to be turned on at Cloudflare before any gRPC traffic reaches your tunnel). This page doesn’t repeat it.

Symptom: a CloudflareTunnel, CloudflareDNSRecord, CloudflareAccessApplication, or CloudflareAccessIdentityProvider’s Synced condition (or a DNS-mode CloudflareGatewayStatus’s ancestor status) flips to False with Reason= RateLimited, usually across several objects sharing one credential at once. Fix: nothing to do by hand — the controller already retries with backoff, and the condition clears once the rate-limit window passes. cloudflare_api_rate_limit_hits_total (above) is the metric to watch if this recurs often enough to be worth investigating credential sharing across tenants.

  1. Delete every Route, Gateway, and this project’s own custom resource that carries a finalizer first — while the controller is still running — but not yet your CloudflareGatewayConfiguration objects (step 3 below handles those separately, and later). This order matters: deleting these objects only starts their cleanup. The actual Cloudflare-side deletes (and the ownership-marker checks that guard them) happen in each object’s finalizer, which needs a live controller process to run at all. Uninstalling the chart first would leave every one of those objects stuck Terminating forever, with its finalizer never removed and its real Cloudflare-side resource never cleaned up.

  2. Wait for the finalizers to actually clear before moving on — every kind listed below carries a finalizer; leaving one out of this wait risks moving to step 3 before its cleanup has run, which (per that step’s own note) can orphan its Cloudflare-side resource:

    Terminal window
    kubectl wait --for=delete cloudflaretunnel,cloudflarednsrecord,cloudflareaccessapplication,cloudflareaccessidentityprovider,cloudflareaccessservicetoken,cloudflareaccesspolicy --all --all-namespaces --timeout=120s
  3. Delete your CloudflareGatewayConfiguration objects. Do this after step 2, not before — an object whose finalizer runs after its configuration is already gone has no credential left to authenticate a Cloudflare-side delete with.

  4. Uninstall the chart:

    Terminal window
    helm uninstall cloudflare-gateway-controller --namespace cloudflare-gateway-controller-system
  5. The CRDs stay behind. This is the same Helm behavior that makes step 2 of Upgrade necessary in the first place: Helm never deletes CRDs on helm uninstall either. Leaving them is usually what you want — any remaining custom resources of these kinds (on a multi-tenant cluster, possibly belonging to a different release) stay intact. Deleting them is optional, and genuinely destructive: a CRD delete cascades to every instance of that kind across the entire cluster, not just the ones this release created. Only do this on a cluster where you’re certain nothing else depends on these kinds:

    Terminal window
    kubectl get crd -o name | grep cfgateway.dreamfuselabs.com | xargs kubectl delete
  6. Check for anything orphaned on the Cloudflare side. If step 1 was skipped, or a finalizer was force-removed while the real Cloudflare-side resource still existed, nothing in Kubernetes will tell you that resource is still there — it has no Kubernetes object left to report it. There’s no automated check for this; look in the Cloudflare dashboard for a tunnel, DNS record, or Access application still carrying this project’s ownership marker (see Ownership markers for what that marker looks like for each kind) with no corresponding cluster left to manage it, and remove it by hand if you find one.