cloudflared
by alekc
Cloudflare Tunnel (cloudflared), auto-updated via Renovate on every upstream release, exposes internal services through Cloudflare's edge or runs a TCP/Access tunnel.
About this chart
cloudflared
Cloudflare Tunnel (cloudflared), auto-updated via Renovate on every upstream release, exposes internal services through Cloudflare's edge or runs a TCP/Access tunnel.
cloudflared is Cloudflare's tunnel client: it
dials outbound to Cloudflare's edge and exposes an internal service through it, so nothing
inbound needs to be opened in your firewall. This chart also supports cloudflared access tcp
for TCP-over-tunnel access, and running as a DaemonSet instead of a Deployment. Nothing is
routed until you configure at least a tunnel token or an Access hostname, see "Usage examples"
below. Renovate opens a PR bumping appVersion and this chart's own version together on every
upstream cloudflared release, so a deployed release is never running a stale image without the
chart itself also having moved.
Quick start
From the classic chart repository:
helm repo add alekc https://charts.alekc.dev
helm repo update
helm install my-cloudflared alekc/cloudflared
Or directly from the OCI registry, no helm repo add needed:
helm install my-cloudflared oci://charts.alekc.dev/cloudflared --version 1.7.0
Verifying the signature
curl -sO https://charts.alekc.dev/pubring.gpg
helm pull oci://charts.alekc.dev/cloudflared --version 1.7.0 --verify --keyring pubring.gpg
Usage examples
Using cloudflared for ingress. Token is sources from a secret
fullnameOverride: cloudflared-ingress
log:
application: "info"
transport: "info"
deployment:
kind: DaemonSet
env:
simple:
TUNNEL_TRANSPORT_PROTOCOL: http2 # If you have problems with default quic
full:
- name: TUNNEL_TOKEN
valueFrom:
secretKeyRef:
name: cloudflared-tunnel-secret
key: cloudflared_k8s_tunnel
Running tcp tunnel access
fullnameOverride: cloudflared-tcp-mqtt
livenessProbe:
enabled: false
readinessProbe:
enabled: false
metrics:
enabled: false
deployment:
ports:
containerPort: 1883
name: mqtt
protocol: TCP
env:
full:
- name: TUNNEL_ACCESS_ID
value: "xxx.access" # or you can mount it directly from a secret
- name: TUNNEL_ACCESS_SECRET
value: "***"
args:
- access
- tcp
- "--hostname"
- "tcppublichost.domain.ltd"
- "--url"
- "0.0.0.0:1883"
Homepage: https://github.com/cloudflare/cloudflared
Maintainers
| Name | Url | |
|---|---|---|
| alekc | [email protected] | https://blog.alekc.org |
Source Code
Gotchas
livenessProbe/readinessProbetarget port 2000, the same portmetrics.enabledbinds cloudflared's metrics server to. Disablingmetricswithout also disabling both probes leaves them pointed at a port nothing listens on, and the pod never becomes Ready. The "Running tcp tunnel access" example above disables all three together for exactly this reason.networkPolicy.enabledallows broad egress to0.0.0.0/0:443by default. cloudflared dials a changing set of Cloudflare edge IPs over QUIC/HTTP2, there is no small fixed range to allowlist out of the box. Narrow it withnetworkPolicy.extraEgressif your environment needs a tighter policy (e.g. Cloudflare's published IP ranges).metrics.serviceMonitor.enabledrequiresmetrics.enabled. The chart refuses to render a ServiceMonitor otherwise, cloudflared's/metricsendpoint is only served onceTUNNEL_METRICSis set, which only happens whenmetrics.enabledis true.podDisruptionBudget.enabledis only meaningful oncereplicaCount(orautoscaling.minReplicas) is greater than 1. With a single replica, a PDB withminAvailable: 1blocks voluntary node draining entirely, since there is no second pod to take over first.
Upgrade notes
No breaking changes yet. This section will list migration steps for any future release with
a kind: removed or kind: changed entry in artifacthub.io/changes that requires one.
Values
| Key | Type | Default | Description |
|---|---|---|---|
| additionalManifests | object | {} | List of additional manifests to include |
| affinity | object | {} | Affinity rules for pod scheduling |
| autoscaling | object | {"annotations":{},"enabled":false,"maxReplicas":10,"minReplicas":1,"targetCPUUtilizationPercentage":80} | Autoscaling configuration |
| autoscaling.annotations | object | {} | Annotations to add to the HorizontalPodAutoscaler |
| autoscaling.enabled | bool | false | Enable or disable autoscaling |
| autoscaling.maxReplicas | int | 10 | Maximum number of replicas |
| autoscaling.minReplicas | int | 1 | Minimum number of replicas |
| autoscaling.targetCPUUtilizationPercentage | int | 80 | Target CPU utilization percentage |
| commonAnnotations | object | {} | Common annotations merged onto every resource, in addition to each resource's own dedicated annotations field. |
| commonLabels | object | {} | Common labels to be added to all resources |
| config | object | {"annotations":{},"data":{},"enabled":false} | Application-specific configuration |
| config.annotations | object | {} | Annotations to add to the ConfigMap |
| config.data | object | {} | Key-value pairs for the configuration |
| config.enabled | bool | false | Enable or disable the configuration map |
| deployment | object | {"additionalMounts":[],"additionalVolumes":[],"annotations":{},"args":["tunnel","run"],"kind":"Deployment","ports":{"additionalPorts":[],"containerPort":80,"name":"http","protocol":"TCP"},"revisionHistoryLimit":2,"strategy":{"type":"RollingUpdate"}} | Deployment configuration |
| deployment.additionalMounts | list | [] | Additional volume mounts |
| deployment.additionalVolumes | list | [] | Additional volumes to mount |
| deployment.annotations | object | {} | Annotations to add to the deployment |
| deployment.ports | object | {"additionalPorts":[],"containerPort":80,"name":"http","protocol":"TCP"} | Deployment ports |
| deployment.ports.additionalPorts | list | [] | List of additional ports to expose |
| deployment.ports.containerPort | int | 80 | The main container port to expose |
| deployment.ports.name | string | "http" | The name of the main container port |
| deployment.ports.protocol | string | "TCP" | The protocol for the main container port (e.g., TCP, UDP) |
| deployment.revisionHistoryLimit | int | 2 | Number of old ReplicaSets to retain for rollback |
| deployment.strategy | object | {"type":"RollingUpdate"} | Deployment strategy (e.g., RollingUpdate, Recreate) |
| env | object | {"full":[],"simple":{"TZ":"UTC"}} | Environment variables for the container |
| env.full | list | [] | Full environment variable definitions |
| env.simple | object | {"TZ":"UTC"} | Simple key-value environment variables |
| extraContainers | list | [] | Extra sidecar containers appended to the pod spec, templated with tpl so they can reference .Release.Namespace and friends. |
| fullnameOverride | string | "" | Override the full name of the chart |
| image | object | {"pullPolicy":"IfNotPresent","repository":"cloudflare/cloudflared","tag":""} | Container image configuration |
| image.pullPolicy | string | "IfNotPresent" | Image pull policy (e.g., Always, IfNotPresent) |
| image.repository | string | "cloudflare/cloudflared" | Image repository (e.g., nginx, redis) |
| image.tag | string | "" | Image tag (overrides the chart appVersion if specified) |
| imagePullSecrets | list | [] | Secrets for pulling images from private registries |
| initContainers | list | [] | Extra init containers appended to the pod spec, templated with tpl. |
| livenessProbe | object | {"config":{"failureThreshold":3,"httpGet":{"path":"/healthcheck","port":2000},"initialDelaySeconds":10,"periodSeconds":10},"enabled":true} | Liveness probe configuration |
| livenessProbe.config | object | {"failureThreshold":3,"httpGet":{"path":"/healthcheck","port":2000},"initialDelaySeconds":10,"periodSeconds":10} | Liveness probe settings |
| livenessProbe.enabled | bool | true | Enable or disable the liveness probe |
| log.application | string | "info" | Application logging level {debug, info, warn, error, fatal}. At debug level cloudflared will log request URL, method, protocol, content length, as well as, all request and response headers. This can expose sensitive information in your logs. (default: "info") [$TUNNEL_LOGLEVEL] |
| log.format | string | "default" | Output format for the logs (default, json) (default: "default") |
| log.transport | string | "info" | Transport logging level(previously called protocol logging level) {debug, info, warn, error, fatal} (default: "info") [$TUNNEL_PROTO_LOGLEVEL, $TUNNEL_TRANSPORT_LOGLEVEL] |
| metrics.enabled | bool | true | Note: This HAVE to be DISABLED if you are using cloudflared in access tcp mode. |
| metrics.serviceMonitor.additionalLabels | object | {} | Additional labels merged onto the ServiceMonitor itself (for a Prometheus Operator serviceMonitorSelector). |
| metrics.serviceMonitor.annotations | object | {} | Annotations to add to the ServiceMonitor |
| metrics.serviceMonitor.enabled | bool | false | Renders a ServiceMonitor for the Prometheus Operator. Requires the monitoring.coreos.com CRDs and metrics.enabled; the chart refuses to render one without the other, cloudflared's metrics server (which serves /metrics) is only started when metrics are on. |
| metrics.serviceMonitor.interval | string | "30s" | Scrape interval. |
| nameOverride | string | "" | Override the name of the chart |
| networkPolicy.annotations | object | {} | Annotations to add to the NetworkPolicy |
| networkPolicy.enabled | bool | false | Render a NetworkPolicy restricting ingress to the metrics port (when enabled) and egress to DNS plus Cloudflare's edge on 443. cloudflared dials a changing set of edge IPs, so egress here is broad by default, narrow it with extraEgress if you want to pin specific ranges. |
| networkPolicy.extraEgress | list | [] | Additional raw egress rules, appended as-is under spec.egress. |
| networkPolicy.extraIngress | list | [] | Additional raw ingress rules, appended as-is under spec.ingress. |
| nodeSelector | object | {} | Node selector for pod scheduling |
| persistence | object | {"accessMode":"ReadWriteOnce","annotations":{},"enabled":false,"existingClaim":"","mountPath":"/config","size":"800Mi","storageClass":""} | Persistent volume configuration |
| persistence.accessMode | string | "ReadWriteOnce" | Access mode for the volume (e.g., ReadWriteOnce) |
| persistence.annotations | object | {} | Annotations to add to the PersistentVolumeClaim |
| persistence.enabled | bool | false | Enable or disable persistence |
| persistence.existingClaim | string | "" | Use an existing persistent volume claim |
| persistence.mountPath | string | "/config" | Mount path for the volume |
| persistence.size | string | "800Mi" | Size of the volume |
| persistence.storageClass | string | "" | Storage class to use for the volume |
| podAnnotations | object | {} | Annotations to add to pods |
| podDisruptionBudget | object | {"annotations":{},"enabled":false,"minAvailable":1} | Pod disruption budget configuration. Only meaningful once replicaCount (or autoscaling.minReplicas) is greater than 1. |
| podDisruptionBudget.annotations | object | {} | Annotations to add to the PodDisruptionBudget |
| podDisruptionBudget.enabled | bool | false | Enable or disable the pod disruption budget |
| podDisruptionBudget.minAvailable | int | 1 | Minimum number of available pods |
| podSecurityContext | object | {} | Pod security context |
| priorityClassName | string | "" | Priority class name for pods |
| readinessProbe | object | {"config":{"failureThreshold":3,"httpGet":{"path":"/healthcheck","port":2000},"initialDelaySeconds":10,"periodSeconds":10},"enabled":true} | Readiness probe configuration |
| readinessProbe.config | object | {"failureThreshold":3,"httpGet":{"path":"/healthcheck","port":2000},"initialDelaySeconds":10,"periodSeconds":10} | Readiness probe settings |
| readinessProbe.enabled | bool | true | Enable or disable the readiness probe |
| replicaCount | int | 1 | Number of replicas to deploy |
| resources | object | {"limits":{"memory":"256Mi"},"requests":{"cpu":"50m","memory":"128Mi"}} | Resource requests and limits for the container |
| resources.limits | object | {"memory":"256Mi"} | Resource limits |
| resources.requests | object | {"cpu":"50m","memory":"128Mi"} | Resource requests |
| securityContext | object | {} | Container security context |
| service | object | {"annotations":{},"ports":{"name":"http","port":"","protocol":"TCP"},"type":"ClusterIP"} | Service configuration |
| service.annotations | object | {} | Service annotations |
| service.ports.name | string | "http" | Service name |
| service.ports.port | string | "" | Service port. If empty will use the container port |
| service.ports.protocol | string | "TCP" | Protocol for the service port (e.g., TCP, UDP) |
| service.type | string | "ClusterIP" | Service type (e.g., ClusterIP, NodePort, LoadBalancer) |
| serviceAccount | object | {"annotations":{},"create":true,"name":""} | Service account configuration |
| serviceAccount.annotations | object | {} | Annotation |
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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcloudflared is pinned at v1.10.2 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