tfy-cloudflared
by TrueFoundry
Cloudflare Tunnel client for secure, outbound-only connections between Kubernetes services and Cloudflare's network
About this chart
Tfy-cloudflared helm chart packaged by TrueFoundry
Tfy-cloudflared vendors the upstream Cloudflare Tunnel chart into this repository so it can be maintained and released from the TrueFoundry charts repo.
It deploys cloudflared for secure, outbound-only connections between services in your cluster and Cloudflare's network.
This chart also deploys Caddy resources for private endpoint routing.
Caddy private endpoint routing
When caddy.enabled=true, a Caddy reverse proxy is deployed alongside cloudflared. It accepts inbound requests forwarded by the Cloudflare tunnel and proxies them to in-cluster services.
URL scheme
All requests must include a <tunnel-identifier> prefix segment immediately followed by the target address. Four address formats are supported:
| Format | Example URL | Backend transport |
|---|---|---|
/<tunnel-identifier>/http://host:port[/path] | /my-tunnel/http://svc.ns.svc.cluster.local:8080/api | Plain HTTP |
/<tunnel-identifier>/https://host:port[/path] | /my-tunnel/https://svc.ns.svc.cluster.local:443/api | TLS (SNI from host) |
/<tunnel-identifier>/https/host:port[/path] | /my-tunnel/https/svc.ns.svc.cluster.local:443/api | TLS (SNI from host) |
/<tunnel-identifier>/host:port[/path] | /my-tunnel/svc.ns.svc.cluster.local:8080/api | Plain HTTP |
The <tunnel-identifier> segment is consumed by Caddy and is not forwarded to the upstream service. The remaining path after the host:port is forwarded as-is.
Restricting upstream hosts (caddy.allowedHosts)
By default Caddy proxies to whatever host:port is present in the request path, i.e. any address reachable from the Caddy pod's network. In a shared cluster this means the blast radius is "anything the pod can reach", not just the services you intend to expose.
Set caddy.allowedHosts to lock routing down to an explicit allowlist:
caddy:
allowedHosts:
- my-mcp-server.internal
- some-svc.my-namespace.svc.cluster.local
When the list is non-empty, only those hostnames are routable across all four URL formats; requests to any other target return 404. Entries are hostnames only — do not include a port (the port is still taken from the request path). Hostnames are matched exactly (regex metacharacters are escaped), so svc.ns.svc.cluster.local will not match evil-svc.ns.svc.cluster.local.
Onboarding a new host is a values change followed by helm upgrade. The Caddy config is mounted via subPath (which does not hot-reload), but the deployment carries a checksum/config annotation, so the upgrade rolls the Caddy pods automatically to pick up the new allowlist.
An empty list (the default) preserves the previous behaviour of proxying to any reachable host.
Parameters
Configuration values for tfy-cloudflared
| Name | Description | Value |
|---|---|---|
nameOverride | Name override | "" |
fullnameOverride | Full name override for the tfy-cloudflared chart | "" |
commonLabels | Common labels added to all resources | {} |
commonAnnotations | Common annotations added to all resources | {} |
image.repository | Image repository for cloudflared | tfy.jfrog.io/tfy-mirror/cloudflare/cloudflared |
image.tag | Image tag for cloudflared | 2026.3.0 |
image.pullPolicy | Image pull policy | IfNotPresent |
imagePullSecrets | Image pull secrets | [] |
tunnel.token | Tunnel token obtained from the Cloudflare dashboard | "" |
tunnel.existingSecret | Name of an existing secret containing the tunnel token | "" |
tunnel.existingSecretKey | Key inside the existing secret that stores the tunnel token | token |
cloudflared.logLevel | Log level for the cloudflared process | info |
cloudflared.noAutoupdate | Disable auto-update for cloudflared | true |
cloudflared.metricsPort | Metrics listen port used for /ready and /metrics | 2000 |
cloudflared.extraArgs | Extra arguments appended to the cloudflared command | [] |
cloudflared.extraEnv | Extra environment variables for the cloudflared container | [] |
cloudflared.networkPolicy.enabled | Create a NetworkPolicy on the cloudflared pods so incoming tunnel requests can only be forwarded to the Caddy router (port 80) and no other in-cluster pod. DNS and the external Cloudflare edge are allowed separately (see below). Ingress is restricted to the metrics port (which also serves the probes). Requires a CNI that enforces NetworkPolicy; it is inert otherwise. | true |
cloudflared.networkPolicy.ingress.allowedFrom | NetworkPolicyPeer entries allowed to reach the cloudflared metrics port. Empty (default) allows ingress from anywhere to that port only. |
Deploy tfy-cloudflared with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tfy-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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charttfy-cloudflared is pinned at v0.6.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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