cloudflared

by lola.2lannoy

Helm chartv0.2.9App 2026.11.1Apache-2.0Verified publisher

Cloudflare Tunnel connector (cloudflared) running as a hardened, highly available Deployment

About this chart

cloudflared

Cloudflare Tunnel connector (cloudflared) running as a hardened, highly available Deployment

Runs cloudflared as a Deployment of tunnel connectors. Every replica is one more connector of the same tunnel (4 connections to Cloudflare each), so replicas give availability and capacity. A DaemonSet is deliberately not offered: Cloudflare caps a tunnel at 25 replicas / 100 connections, and connectors do not need to run next to the origins.

Install

The chart never creates the tunnel Secret: credentials must not live in Helm values, release history or Git. Create it first, then install.

Token mode (default)

For a tunnel managed in the Cloudflare dashboard (remotely managed: ingress rules live in Cloudflare, not in this chart).

kubectl create namespace cloudflared
kubectl -n cloudflared create secret generic cloudflared --from-file=token=./tunnel-token.txt
helm install cloudflared oci://ghcr.io/spnngl/charts/cloudflared --version <version> -n cloudflared

The Secret is named after the release (tunnel.token.existingSecret.name to override, key defaults to token). Local config.originRequest and warp-routing are ignored by cloudflared in this mode and rejected by the schema.

Credentials mode

For a tunnel created with cloudflared tunnel create (locally managed: ingress rules are tunnel.credentials.ingress in this chart).

kubectl -n cloudflared create secret generic cloudflared --from-file=credentials.json=./<tunnel-uuid>.json
helm install cloudflared oci://ghcr.io/spnngl/charts/cloudflared --version <version> -n cloudflared \
  --set tunnel.mode=credentials --set tunnel.credentials.tunnel=<tunnel-uuid> \
  --values ingress.yaml   # tunnel.credentials.ingress: [..., {service: http_status:404}]

tunnel.credentials.tunnel must be the tunnel UUID: resolving a tunnel name needs the account cert.pem, which the chart does not mount.

Other cloudflared options go in config (cloudflared config.yaml keys). Keys the chart owns (metrics, token-file, credentials-file, tunnel, ingress, grace-period, ...) are rejected there.

Secret rotation

cloudflared reads the token / credentials once at startup. After rotating the Secret, restart the pods:

kubectl -n cloudflared rollout restart deployment/cloudflared

or let Reloader do it with podAnnotations: {reloader.stakater.com/auto: "true"}.

Image

The default image is appVersion pinned by the digest recorded in the artifacthub.io/images annotation of Chart.yaml (Renovate updates both together). Setting image.tag drops that digest; add image.digest to pin the tag again (image.digest without image.tag is an error).

Cloudflare does not sign the image (no cosign signature, no attestations, checked on 2026.10.0). The digest pin only guarantees that the same bytes are pulled every time, not who built them.

Availability and scheduling

  • 3 replicas, RollingUpdate with maxUnavailable: 0, maxSurge: 1, and a terminationGracePeriodSeconds of gracePeriodSeconds + 15: cloudflared drains connections on SIGTERM.
  • Default spread: preferred pod anti-affinity on the hostname, preferred topology spread over zones. affinity / topologySpreadConstraints replace these defaults.
  • Replicas (or autoscaling.maxReplicas) plus the rollout surge must stay at or below 25, the Cloudflare cap per tunnel. The chart fails otherwise.
  • podDisruptionBudget.enabled is off by default.
  • Origins: cloudflared resolves origin hostnames itself. Use fully qualified names with a trailing dot (app.default.svc.cluster.local.): with the cluster default ndots, a name with exactly two dots is otherwise tried against every search domain first. The chart sets ndots: 2.

Autoscaling

  • autoscaling (HPA) scales on CPU utilization by default. CPU Utilization is a percentage of resources.requests.cpu: with the 50m floor, the default 75% target fires at about 38m. Size the requests first (VPA in Off mode gives recommendations), or scale on a connection metric such as cloudflared_tunnel_concurrent_requests_per_tunnel through prometheus-adapter or KEDA: CPU is a weak signal for a network-bound proxy.
  • Each pod removed drops four edge connections, hence the slow scale-down default (stabilizationWindowSeconds: 300).
  • Enabling the HPA after install drops the Deployment replicas field: the first apply scales to 1 until the HPA acts (Kubernetes behaviour).
  • verticalPodAutoscaler supports Off, Initial, Recreate and InPlaceOrRecreate (VPA 1.8+, in-place resize needs Kubernetes 1.33+). HPA and VPA must not act on the same resource: with the HPA on, keep the VPA in Off or drop that resource from controlledResources.

Resources

The defaults are scheduling floors, not a sizing: requests 50m CPU / 64Mi memory, a 256Mi memory limit and no CPU limit (throttling adds latency to a proxy). Cloudflare sizes whole hosts (4 CPU / 4 GiB for about 4000 WARP users), and throughput is bounded by ports, not CPU: the chart sets net.ipv4.ip_local_port_range to 11000 60999 and cloudflared wants a file-descriptor limit of at least 70000 (Go raises the soft limit to the runtime's hard limit). Measure, then tune.

With a memory limit set, GOMEMLIMIT follows it, and a memory resize restarts the container so the value never goes stale.

QUIC (UDP) benefits from larger socket buffers: raise net.core.rmem_max / net.core.wmem_max on the nodes if cloudflared logs a buffer size warning.

Security

Defaults satisfy the restricted Pod Security Standard: non-root uid/gid 65532, read-only root filesystem, all capabilities dropped, no privilege escalation, RuntimeDefault seccomp, no ServiceAccount token, no Service environment variables. cloudflared needs no capability: ICMP proxying uses unprivileged ICMP sockets, enabled by the net.ipv4.ping_group_range sysctl (a safe sysctl).

Not defaulted, because each makes the kubelet refuse the pod on some nodes: appArmorProfile (hosts without AppArmor) and supplementalGroupsPolicy: Strict (runtimes without support). Set them in podSecurityContext / securityContext if your nodes support them.

User namespaces

hostUsers: false (default) runs the pod in a user namespace: uid 65532 in the pod maps to an unprivileged host uid, which limits what a container escape gains. Nodes need a container runtime with user namespace support (containerd 2.0+ or CRI-O), runc 1.2+ or crun, and a Linux kernel 6.3+ (idmapped mounts on tmpfs for Secret and ConfigMap volumes); see the Kubernetes documentation on user namespaces. On other nodes the pod sandbox cannot be created (event on the pod, for example error mounting "sysfs" to rootfs ... operation not permitted on kind inside a CI runner): set hostUsers: true.

Writable paths

The root filesystem is read-only and cloudflared writes nothing by default. logfile, log-directory, pidfile and trace-output need a writable path: add an emptyDir with extraVolumes / extraVolumeMounts.

Network

  • Warning: the metrics port also serves /debug/pprof, /config (remote ingress rules, origin URLs) and /diag/*. The NetworkPolicy (networkPolicy.enabled, on by default) restricts ingress to that port, but with networkPolicy.metrics.from: [] any in-cluster source is allowed: set it to your Prometheus namespace / pods, and expose the port only through metrics.service / the monitors when needed.
  • networkPolicy.egress.enabled (off by default) allows DNS and the Cloudflare edge (7844, TCP and UDP) only. Origins are not covered: add them in networkPolicy.egress.extraEgress. Override dns.to for NodeLocal DNSCache or a non-default DNS namespace, edge.to to restrict the edge ranges. Port 443 is not needed: cloudflared's start-up "Cloudflare API" precheck logs a failure without it, but it is informational (hard_fail=false) and the tunnel connects over 7844 (checked on kind with the policy enforced).
  • metrics.serviceMonitor or metrics.podMonitor (not both) integrate with the Prometheus Operator; a PodMonitor needs no Service.
  • metrics.prometheusRule adds alerts and needs one of the monitors (the rules select the job label it sets; do not rewrite job in relabelings). CloudflaredTunnelDown (critical) fires when no replica is ready while some are desired, from kube-state-metrics: cloudflared_tunnel_ha_connections cannot tell, it counts connections still retrying (an invalid token keeps it at 1 while /ready returns 503). CloudflaredRegistrationFailing and CloudflaredOriginErrors (warning) read cloudflared's own metrics.
  • helm test runs cloudflared tunnel ready against the metrics Service and succeeds once at least one connection is up (the Service only routes to ready pods, so it fails while no connector is registered). It exists only when the metrics Service is rendered (metrics.service.enabled or a ServiceMonitor) and there is at least one connector (replicaCount > 0 or autoscaling).

Compatibility

The values schema is strict: unknown keys fail the install. A breaking change to values bumps the chart MAJOR version; deprecations are announced one MINOR version ahead. Requires Kubernetes 1.33 or later.

Maintainers

NameEmailUrl
spnnglhttps://github.com/spnngl

Source Code

Requirements

Kubernetes: >=1.33.0-0

Values

KeyTypeDefaultDescription
affinityobject{}Affinity. Empty: preferred podAntiAffinity on hostname. A non-empty value replaces that default wholesale.
autoscaling.behaviorobject{"scaleDown":{"stabilizationWindowSeconds":300}}HPA behavior. Slow scale-down: each removed pod drops four edge connections.
autoscaling.enabledboolfalseCreate a HorizontalPodAutoscaler. Enabling it drops replicas from the Deployment: it falls to 1 until the HPA reacts.
autoscaling.maxReplicasint10HPA maximum replicas (the rollout surge counts toward the 25 per tunnel cap).
autoscaling.metricslist[{"resource":{"name":"cpu","target":{"averageUtilization":75,"type":"Utilization"}},"type":"Resource"}]Raw autoscaling/v2 MetricSpec list. CPU Utilization is a percentage of resources.requests.cpu: with the 50m floor, 75% fires at ~38m, so size requests first.
autoscaling.minReplicasint3HPA minimum replicas.
configobject{}Free-form cloudflared configuration (config.yaml), any flag works (loglevel, protocol, edge-ip-version, warp-routing, originRequest, ...). Chart-owned keys are rejected; originRequest and warp-routing are also rejected in token mode (remote configuration owns them).
dnsConfigobject{"options":[{"name":"ndots","value":"2"}]}DNS config.
dnsConfig.optionslist[{"name":"ndots","value":"2"}]DNS options (fewer search-list lookups for origin FQDNs).
extraArgslist[]Extra cloudflared tunnel options, placed after --config and before run (for example --output=json). run-only options do not parse there: set them in config.
extraEnvlist[]Extra environment variables (EnvVar list) for the cloudflared container, for flags config.yaml does not read (for example TUNNEL_LOG_OUTPUT: json). Rendered after GOMEMLIMIT.
extraVolumeMountslist[]Extra volume mounts for the cloudflared container.
extraVolumeslist[]Extra volumes (for example an origin CA bundle for originRequest.caPool, or an emptyDir for logfile/pidfile: the root filesystem is read-only).
fullnameOverridestring""Override the full resource name (default <release>-<chart>).
gracePeriodSecondsint30Drain time after SIGTERM (grace-period); terminationGracePeriodSeconds is this + 15.
hostUsersboolfalseRun the pod in a user namespace (false: container root/uid 65532 maps to an unprivileged host uid). Needs node support (containerd 2.0+ or CRI-O, runc 1.2+, kernel 6.3+); pods fail to start otherwise. true uses host users.
image.digeststring""Image digest, only valid together with image.tag.
image.pullPolicystring"IfNotPresent"Image pull policy.
image.repositorystring"docker.io/cloudflare/cloudflared"Image repository.
image.tagstring""Image tag. Empty: appVersion pinned by the digest recorded in Chart.yaml. When set, the chart digest is not applied; add image.digest to pin it.
imagePullSecretslist[]Image pull secrets (list of {name: <secret>}).
livenessProbeobject{"failureThreshold":3,"httpGet":{"path":"/healthcheck","port":"metrics"},"periodSeconds":10}Liveness probe, /healthcheck (process alive only). Not /ready: an edge outage must not restart every pod, cloudflared reconnects by itself.
metrics.podMonitor.enabledboolfalseCreate a Prometheus Operator PodMonitor (no Service needed). Exclusive with serviceMonitor.
metrics.podMonitor.intervalstring""Scrape interval (empty: Prometheus default).
metrics.podMonitor.labelsobject{}Extra labels.
metrics.podMonitor.metricRelabelingslist[]Metric relabelings.
metrics.podMonitor.relabelingslist[]Relabelings.
metrics.podMonitor.scrapeTimeoutstring""Scrape timeout (empty: Prometheus default).
metrics.prometheusRule.disabledlist[]Alerts to leave out (at most two: disable prometheusRule instead). CloudflaredTunnelDown reads kube-state-metrics (kube_deployment_status_replicas_available, kube_deployment_spec_replicas): without it, it never f

Deploy cloudflared with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cloudflared on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcloudflared is pinned at v0.2.9 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply