cloudflare-ddns

by benji

Helm chartv0.1.0App 1.17.1Verified publisher

Cloudflare DDNS updater (favonia/cloudflare-ddns) - keeps Cloudflare DNS records pointed at the current public IP of the network the cluster runs in

About this chart

cloudflare-ddns

Cloudflare DDNS updater (favonia/cloudflare-ddns) - keeps Cloudflare DNS records pointed at the current public IP of the network the cluster runs in

This chart runs favonia/cloudflare-ddns, a small updater that detects the public IP address of the network it runs in and keeps Cloudflare DNS records pointed at it. Upstream ships only the container image (its Kubernetes manifests are no longer maintained); this chart is the Deployment around it.

API token

Create a Cloudflare API token with Zone - DNS - Edit, scoped to the zone(s) of the managed domains. Nothing else is needed.

Either pass it inline (cloudflare.apiToken, the chart stores it in a Secret), or reference a Secret you manage yourself (cloudflare.existingSecret). Set exactly one. The token is mounted as a file and read through CLOUDFLARE_API_TOKEN_FILE, so it never shows up in the process environment.

With GitOps, keep the token out of plain-text values: for example a SOPS-encrypted values file (helm-secrets) for cloudflare.apiToken, or an external-secrets / sealed-secrets object for cloudflare.existingSecret.

Which records

domains are managed for A and AAAA, ip4Domains / ip6Domains for one family only. Wildcards (*.example.com) work. The updater only touches the listed names; other records in the zone are left alone.

If the records must not get AAAA records (e.g. the cluster's pods have no IPv6, or IPv6 isn't published on purpose), set ip6Provider: none.

Detection from inside the cluster

The default provider (cloudflare.trace) asks Cloudflare which address the request came from, so it sees the address the cluster's outbound traffic is NATed to. That is what you want for a home network behind a single public IP. Providers that read a local interface address (local, local.iface) need hostNetwork: true.

Only one updater

The Deployment always runs one replica with the Recreate strategy, so two updaters never race on the same records. deleteOnStop stays off by default: with it on, every pod restart or rollout would briefly delete the records.

Installing the Chart

This chart is published two ways: as a classic Helm repo via GitHub Pages (releases only), and as an OCI artifact via the GitHub Container Registry (releases and alpha builds).

Via the classic repo:

$ helm repo add newbenji-charts https://newbenji.github.io/charts/
$ helm repo update
$ helm install my-release newbenji-charts/cloudflare-ddns --version 0.1.0

Via OCI:

$ helm install my-release oci://ghcr.io/newbenji/charts/cloudflare-ddns --version 0.1.0

To just download the chart package:

$ helm pull oci://ghcr.io/newbenji/charts/cloudflare-ddns --version 0.1.0

Maintainers

NameEmailUrl
newbenji[email protected]

Source Code

Values

KeyTypeDefaultDescription
affinityobject{}Affinity for pod assignment
cloudflare.apiTokenstring""Cloudflare API token. The chart stores it in a Secret. Needs only Zone - DNS - Edit on the zone(s) of the managed domains. Leave empty when using cloudflare.existingSecret
cloudflare.existingSecret.keystring"api-token"Key in that Secret holding the token
cloudflare.existingSecret.namestring""Name of an existing Secret holding the API token. Takes the place of cloudflare.apiToken; set exactly one of the two
commonAnnotationsobject{}Annotations added to every resource the chart creates
commonLabelsobject{}Labels added to every resource the chart creates
deleteOnStopboolfalseDelete the managed records when the updater stops (DELETE_ON_STOP). Keep this off in Kubernetes: every pod restart or rollout would briefly remove the records
deploymentAnnotationsobject{}Annotations to add to the Deployment
domainslist[]Domains whose A and AAAA records are managed (DOMAINS). Wildcards like *.example.com are supported. At least one of domains, ip4Domains or ip6Domains must be set
emojiboolfalseEmoji in log lines (EMOJI). Off by default so log collectors get plain text
extraEnvlist[]Extra environment variables for the container, e.g. HEALTHCHECKS / UPTIMEKUMA monitoring URLs (put those in a Secret and use valueFrom)
fullnameOverridestring""Overrides the Full Name of resources
hostNetworkboolfalseRun the pod in the node's network namespace. Only needed for the local / local.iface IP providers
image.digeststring""Pin the image by digest (e.g. sha256:...). When set, it's used in addition to the tag (repo:tag@digest), so the tag stays readable but can't be silently re-pointed
image.pullPolicystring"IfNotPresent"Docker image pull policy
image.repositorystring"favonia/cloudflare-ddns"Docker registry/repository to pull the image from
image.tagstring""Overrides the default tag (appVersion) used in Chart.yaml. Defaults to the chart's appVersion (1.17.1) when left empty. See available tags at https://hub.docker.com/r/favonia/cloudflare-ddns/tags
imagePullSecretslist[]Docker image pull secrets
ip4Domainslist[]Extra domains managed for A (IPv4) records only (IP4_DOMAINS)
ip4Providerstring"cloudflare.trace"How the public IPv4 address is detected (IP4_PROVIDER), e.g. cloudflare.trace, cloudflare.doh, url:<url>, or none to not manage A records. local needs hostNetwork: true
ip6Domainslist[]Extra domains managed for AAAA (IPv6) records only (IP6_DOMAINS)
ip6Providerstring"cloudflare.trace"How the public IPv6 address is detected (IP6_PROVIDER). Set to none to not manage AAAA records, e.g. when pods have no IPv6 or the records shouldn't be published
managedRecordsCommentRegexstring""Only manage existing records whose comment matches this RE2 regex (MANAGED_RECORDS_COMMENT_REGEX). Empty means all records of the listed domains
nameOverridestring""Overrides the name of resources
nodeSelectorobject{}Node labels for pod assignment
podAnnotationsobject{}Annotations to add to the pod
podLabelsobject{}Labels to add to the pod
podSecurityContextobject{"fsGroup":1000,"runAsGroup":1000,"runAsNonRoot":true,"runAsUser":1000,"seccompProfile":{"type":"RuntimeDefault"}}Pod-level security context. The image runs as any non-root UID; fsGroup makes the mounted token file readable
priorityClassNamestring""Priority class for the pod
proxiedstring"false"Proxy status for the records (PROXIED): true, false, or a domain expression (see the upstream docs)
quietboolfalseReduce logging to errors and changes (QUIET)
recordCommentstring""Comment set on records the updater creates (RECORD_COMMENT)
resourcesobject{"limits":{"memory":"64Mi"},"requests":{"cpu":"5m","memory":"16Mi"}}Resource requests and limits. The updater is a small Go binary that sleeps between checks
revisionHistoryLimitint3Number of old ReplicaSets to keep for rollback
securityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true}Container-level security context
timezonestring"UTC"Timezone for log timestamps and cron parsing (TZ)
tolerationslist[]Tolerations for pod assignment
ttlint1TTL in seconds for the records (TTL). 1 means automatic
updateCronstring"@every 5m"Update schedule (UPDATE_CRON): a cron expression, @every <duration>, or @once
updateOnStartbooltrueCheck and update immediately on start (UPDATE_ON_START)

Autogenerated from chart metadata using helm-docs v1.14.2

Deploy cloudflare-ddns with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cloudflare-ddns 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 chartcloudflare-ddns is pinned at v0.1.0 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