infra: add Headscale — self-hosted Tailscale control plane

- headscale.tf: namespace + 1Gi PVC for SQLite state
- apps/headscale.yaml: Deployment (headscale/headscale:0.23) + Service + ConfigMap
  - server_url: https://headscale.neuralplatform.ai
  - sqlite3 backend, DERP via Tailscale's map
  - MagicDNS base: vpn.neuralplatform.ai
- Cloudflare tunnel: headscale.neuralplatform.ai → headscale.headscale.svc:8080
- DNS CNAME added via API

Next: install tailscaled on Legion host, enroll as subnet router
This commit is contained in:
Will Anderson
2026-03-25 07:59:46 -05:00
parent 1312be1a03
commit 5334881d3f
2 changed files with 146 additions and 0 deletions
+113
View File
@@ -0,0 +1,113 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: headscale-config
namespace: headscale
data:
config.yaml: |
server_url: https://headscale.neuralplatform.ai
listen_addr: 0.0.0.0:8080
grpc_listen_addr: 0.0.0.0:50443
grpc_allow_insecure: true
private_key_path: /data/private.key
noise:
private_key_path: /data/noise_private.key
ip_prefixes:
- 100.64.0.0/10
db_type: sqlite3
db_path: /data/headscale.db
log:
level: info
dns_config:
nameservers:
- 100.64.0.1
magic_dns: true
base_domain: vpn.neuralplatform.ai
derp:
server:
enabled: false
urls:
- https://controlplane.tailscale.com/derpmap/default
auto_update_enabled: true
update_frequency: 24h
disable_check_updates: true
ephemeral_node_inactivity_timeout: 30m
node_update_check_interval: 10s
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: headscale
namespace: headscale
labels:
app: headscale
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: headscale
template:
metadata:
labels:
app: headscale
spec:
containers:
- name: headscale
image: headscale/headscale:0.23
command: ["headscale", "serve"]
ports:
- name: http
containerPort: 8080
- name: grpc
containerPort: 50443
volumeMounts:
- name: data
mountPath: /data
- name: config
mountPath: /etc/headscale/config.yaml
subPath: config.yaml
resources:
requests:
memory: 64Mi
cpu: 50m
limits:
memory: 256Mi
cpu: 200m
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 5
periodSeconds: 10
volumes:
- name: data
persistentVolumeClaim:
claimName: headscale-data
- name: config
configMap:
name: headscale-config
---
apiVersion: v1
kind: Service
metadata:
name: headscale
namespace: headscale
spec:
selector:
app: headscale
ports:
- name: http
port: 8080
targetPort: 8080
- name: grpc
port: 50443
targetPort: 50443
type: ClusterIP