headscale

by gabe565

Helm chartv0.16.0App v0.25.0Verified publisher

An open source, self-hosted implementation of the Tailscale control server.

About this chart

Headscale

An open source, self-hosted implementation of the Tailscale control server.

Homepage: https://charts.gabe565.com/charts/headscale/

This chart is not maintained by the upstream project and any issues with the chart should be raised here

Source Code

Requirements

Kubernetes: >=1.22.0-0

Dependencies

RepositoryNameVersion
https://bjw-s.github.io/helm-chartscommon1.5.1
https://charts.bitnami.com/bitnamipostgresql14.0.5

Installing the Chart

To install the chart with the release name headscale

OCI (Recommended)

helm install headscale oci://ghcr.io/gabe565/charts/headscale

Traditional

helm repo add gabe565 https://charts.gabe565.com
helm repo update
helm install headscale gabe565/headscale

Uninstalling the Chart

To uninstall the headscale deployment

helm uninstall headscale

The command removes all the Kubernetes components associated with the chart including persistent volumes and deletes the release.

Configuration

Read through the values.yaml file. It has several commented out suggested values. Other values may be used from the values.yaml from the bjw-s common library.

Specify each parameter using the --set key=value[,key=value] argument to helm install.

helm install headscale \
  --set env.TZ="America/New York" \
    gabe565/headscale

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.

helm install headscale gabe565/headscale -f values.yaml

Custom configuration

Headscale runs in a distroless Docker container, which does not have any of the expected command line utilities. This keeps the container small and minimizes the possibility of CVEs, but it makes working with a config file in Kubernetes more difficult.

To keep config simple, this Helm chart suggests using environment variables. All of the Headscale config variables are supported as envs, but official documentation is lacking.

To configure Headscale:

  1. See the Headscale example config for available variables.

  2. For any that you want to set: flatten object keys using _, then prefix with HEADSCALE_.

    • For example, the following config:
      disable_check_updates: true
      log:
        level: warn
      
      would be set with the following Helm values:
      env:
        HEADSCALE_DISABLE_CHECK_UPDATES: "true"
        HEADSCALE_LOG_LEVEL: "warn"
      

Also, note that this chart sets some defaults based on your values. See templates/common.yaml for a list.

Headscale UI

You can deploy gurucomputing/headscale-ui as a sidecar container by adding the following values:

sidecars:
  ui:
    image: ghcr.io/gurucomputing/headscale-ui:latest
    ports:
      - name: http
        containerPort: 80

service:
  main:
    ports:
      ui:
        port: 80

ingress:
  ui:
    enabled: true
    hosts:
      - host: example.com
        paths:
          - path: /web
            service:
              port: 80
    tls:
      - ...

Once deployed, the UI will be available at /web.

Values

Important: When deploying an application Helm chart you can add more values from the bjw-s common library chart here

KeyTypeDefaultDescription
argslist["serve"]Container args
configMaps.acl.data.policystringnilACL policy JSON [ref]
configMaps.acl.enabledboolfalseEnables ACL policy
configMaps.dns.data.recordsstringnilDNS extra records JSON [ref]
configMaps.dns.enabledboolfalseEnables DNS extra records
envobjectSee values.yamlEnvironment variables. [ref]
env.HEADSCALE_DNS_BASE_DOMAINstring"example.com"Defines the base domain to create the hostnames for MagicDNS. This domain must be different from the server_url domain.
env.HEADSCALE_DNS_MAGIC_DNSstring"true"Whether to use MagicDNS.
env.HEADSCALE_DNS_NAMESERVERS_GLOBALstring"1.1.1.1 1.0.0.1"List of DNS servers to expose to clients.
env.HEADSCALE_PREFIXES_V4string"100.64.0.0/10"Node IPv4 prefixes
env.HEADSCALE_PREFIXES_V6string"fd7a:115c:a1e0::/48"Node IPv6 prefixes
image.pullPolicystring"IfNotPresent"image pull policy
image.repositorystring"ghcr.io/juanfont/headscale"image repository
image.tagstring"v0.25.0"image tag
ingress.mainobjectSee values.yamlEnable and configure ingress settings for the chart under this key.
persistence.configobjectSee values.yamlConfigure persistence settings for the chart under this key.
postgresqlobjectSee values.yamlEnable and configure postgresql database subchart under this key. For more options see postgresql chart documentation
service.mainobjectSee values.yamlConfigures service settings for the chart.
serviceMonitor.main.enabledboolfalseEnables or disables the serviceMonitor.
serviceMonitor.main.endpointslistSee values.yamlConfigures the endpoints for the serviceMonitor.

Autogenerated from chart metadata using helm-docs

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.16.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