headscale

by QuenchWorks

Helm chartv0.0.20App 0.29.7BSD-3-ClauseVerified publisher

Self-hosted, open-source implementation of the Tailscale control server (Go). Hardened by QuenchWorks as a minimal, nonroot, CVE-gated image, cosign-signed and pinned by digest.

About this chart

Quenchworks headscale

Hardened headscale, an open-source implementation of the Tailscale control server, on a minimal, nonroot, CVE-gated image pinned by digest and cosign-signed (keyless / Sigstore). Single node; it persists its SQLite DB and generated noise/machine keys to a PVC, and its config ships via a ConfigMap mounted at /etc/headscale/config.yaml. The chart pins the image by its signed digest, never a tag.

Install

helm install my-headscale oci://ghcr.io/quenchworks/charts/headscale \
  --set serverUrl=https://headscale.example.com

Then create a user and a pre-auth key, and point a client at the server:

kubectl exec -it my-headscale-headscale-0 -- \
  headscale --config /etc/headscale/config.yaml users create alice
kubectl exec -it my-headscale-headscale-0 -- \
  headscale --config /etc/headscale/config.yaml preauthkeys create --user 1

tailscale up --login-server https://headscale.example.com

serverUrl must be a URL your nodes can reach (normally an HTTPS endpoint via an Ingress/LoadBalancer terminating TLS in front of this Service) and must not be a subdomain of dns.base_domain.

Verify the image

cosign verify ghcr.io/quenchworks/images/headscale \
  --certificate-identity-regexp 'https://github.com/quenchworks/.+' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Each build also ships an SPDX SBOM and SLSA provenance attestation. Verify them with gh attestation verify oci://ghcr.io/quenchworks/images/headscale --owner quenchworks.

Values

KeyDefaultNotes
image.repositoryghcr.io/quenchworks/images/headscale
image.digest(CI-written)Required. Charts pin by digest, never a tag.
image.pullPolicyIfNotPresentAlways, IfNotPresent, or Never.
nameOverride""Override the chart name in resource names.
replicaCount1Fixed at 1: single SQLite writer, do not scale out.
containerPort8080HTTP API / coordination port (nonroot).
metricsPort9090Prometheus metrics port, exposed on the Service as metrics.
serverUrlhttp://127.0.0.1:8080The login-server URL clients use. Override this.
config(see values.yaml)Full headscale config.yaml, tpl-rendered into a ConfigMap.
resources.requestscpu 50m / mem 64Mi
resources.limitscpu 500m / mem 256Mi
args["serve"]Entrypoint verb; override only for maintenance verbs.
service.typeClusterIPClusterIP, NodePort, or LoadBalancer.
service.port8080Forwards to the container's http port.
service.httpsPort443Service port for the TLS listener (container 8443) when tls.enabled.
tls.enabledfalseServe HTTPS on headscale's own listener; the certificate is mounted at /tls.
tls.existingSecret""Use this kubernetes.io/tls Secret (1st choice).
tls.certManager.enabledfalseRequest a cert-manager Certificate from tls.certManager.issuerRef (2nd choice).
tls.selfSigned.validityDays365Otherwise Helm generates a CA + certificate, kept across upgrades.
persistence.enabledtrue1Gi PVC mounted at /var/lib/headscale (DB + noise key + socket).
persistence.size1GiRequested volume size.
persistence.dataDir/var/lib/headscaleMount point; must match the paths in config.
persistence.storageClass""Default class if unset.
persistence.accessModes["ReadWriteOnce"]PVC access modes.
persistence.existingClaim""Bind an existing PVC instead of provisioning one.
serviceAccount.createtrueToken automount is off.
serviceAccount.name""Use an existing ServiceAccount if set.
rbac.createfalseMinimal empty Role/RoleBinding when enabled.
networkPolicy.enabledtrueClient ingress from the release namespace.
networkPolicy.allowExternalfalseSet true to allow ingress from any source.
podDisruptionBudget.enabledtrue
podDisruptionBudget.minAvailable1
ingress.enabledfalseCreate an Ingress for this chart. With tls.enabled it routes to service.httpsPort: set the controller's backend protocol to HTTPS.
ingress.className""IngressClass to claim it. Empty leaves it unset, so the cluster default applies.
ingress.annotations{}Controller annotations (rewrite targets, body size, cert-manager issuer, ...).
ingress.servicePortnullBackend port. Unset resolves service.port, then service.ports.http / .https.
ingress.hosts[]e.g. [{host: app.example.com}]. A host with no paths gets a single / Prefix path.
ingress.tls[]Standard Ingress TLS list, e.g. [{hosts: [app.example.com], secretName: app-tls}].

Plus the shared quench-common knobs: podLabels, podAnnotations, nodeSelector, affinity, tolerations, topologySpreadConstraints, priorityClassName, schedulerName, terminationGracePeriodSeconds, updateStrategy, extraEnvVars, extraEnvVarsCM, extraEnvVarsSecret, extraVolumes, extraVolumeMounts, initContainers, sidecars, lifecycleHooks, command, podSecurityContext, containerSecurityContext, and the probe overrides (livenessProbe, readinessProbe, customLivenessProbe/customReadinessProbe/customStartupProbe).

Architecture

headscale runs as a single-node StatefulSet. It is the single writer of a local SQLite database plus its generated noise/machine keys, so it cannot be scaled horizontally (the schema caps replicaCount at 1). The entire config.yaml lives in .Values.config and is rendered through Helm's tpl, so serverUrl, the ports and the data dir resolve at render time; it is mounted read-only at /etc/headscale/config.yaml. All state paths (noise key, SQLite DB, control socket) point at the PVC data dir (/var/lib/headscale) so headscale can write them under the read-only root filesystem, generating its noise private key there on first boot.

The HTTP API and coordination endpoint is on containerPort (8080); Prometheus metrics on metricsPort (9090), exposed on the Service as metrics; gRPC (remote CLI) stays on loopback (127.0.0.1:50443) unless you deliberately expose it. /health (HTTP 200) backs both the liveness and readiness probes. The pod runs nonroot (uid 1001) on a read-only root filesystem with all capabilities dropped; only the PVC is writable. Editing config and running helm upgrade rolls the pod via a checksum annotation.

Configuration examples

Open the control server to clients outside the cluster (default restricts ingress to the release namespace):

networkPolicy:
  allowExternal: true

Larger data volume on a named storage class:

persistence:
  size: 5Gi
  storageClass: fast-ssd

Change any headscale setting by editing config. It is rendered whole, so copy the default block from values.yaml and edit the keys you need, e.g. MagicDNS base domain and upstream resolvers:

config: |
  server_url: {{ .Values.serverUrl }}
  listen_addr: 0.0.0.0:{{ .Values.containerPort }}
  # ... keep the rest of the default config ...
  dns:
    magic_dns: true
    base_domain: corp.example.com
    nameservers:
      global:
        - 9.9.9.9

Uninstall

helm uninstall my-headscale

The PVC provisioned by the volumeClaimTemplate is retained by Kubernetes on uninstall. Delete it explicitly to drop the SQLite DB and generated keys:

kubectl delete pvc -l app.kubernetes.io/instance=my-headscale

Notes

Single node only: headscale is the single writer of a local SQLite database plus generated keys, so it cannot be horizontally scaled with this chart. For HA you would run an external PostgreSQL backend and a different topology, tracked as a follow-up. The chart depends on the quench-common library chart, pulled from oci://ghcr.io/quenchworks/charts/quench-common. The container runs nonroot on a read-only root filesystem with all capabilities dropped, and the image is pinned by digest.

Deploy headscale with OpenTenant

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