Skip to content

[FEATURE] Add examples/kubernetes-session-teleport-headscale to teleport over a self-hosted Headscale tailnet #1665

Description

@edenreich

Summary

Add examples/kubernetes-session-teleport-headscale, the Headscale twin of examples/kubernetes-session-teleport-netbird. A session teleports from infer-local (a container beside a k3d cluster) to infer-k8s (a pod), whose agent calls a gateway (tokenless, or the Inference Gateway with a real model). Every hop runs over a self-hosted tailnet behind its own policy and on mutual TLS. The README shows the same steps against Tailscale.

#1635 removed SPIFFE so that identity between machines comes from a VPN. docs/daemon.md ("Daemons on other machines") describes a remote daemon behind tailscale serve, and the NetBird example covers one VPN. This one covers Headscale and Tailscale.

What changes from the NetBird example is the VPN only:

  • Headscale has no sidecar injector, so each tailnet pod carries a tailscale/tailscale sidecar.
  • The operator Gateway takes no extra containers, so the real gateway runs as a plain Deployment with the sidecar.
  • Headscale's embedded DERP and STUN replace NetBird's relay, so nothing leaves the cluster. Headscale serves HTTPS with a certificate from the demo CA.

Two TLS paths are worth showing:

  • Daemon-terminated TLS (tls.mode: files on the tailnet address): works on Headscale and Tailscale and keeps forward_env.
  • tailscale serve: terminates HTTPS with a *.ts.net certificate in front of a loopback binding. forward_env does not work behind Serve, because the certificate's key belongs to Tailscale. Headscale v0.29.x cannot issue those certificates (hscontrol: implement tailscale cert and HTTPS serve juanfont/headscale#3554 is on its main branch and needs an ACME DNS-01 provider).

Acceptance Criteria

  • examples/kubernetes-session-teleport-headscale/ mirrors the NetBird example's layout, with the VPN-specific files in headscale/, and docs/examples.md lists it
  • Every node joins Headscale with a tagged, ephemeral pre-auth key, with no account and no API key (mock gateway by default)
  • A Headscale policy lets only infer-local reach infer-k8s's binding port and only infer-k8s reach the gateway port
  • infer-local registers infer-k8s as kind: daemon by its MagicDNS name, with mTLS and forward_env. The README states which TLS path supports forward_env
  • The README walks through:
    • infer daemon workspaces showing the peer reachable
    • infer daemon teleport <id> --to infer-k8s
    • a turn with infer daemon run
    • the teleport back
  • An attacker node outside the policy cannot resolve or reach either binding, and a capture on the node sees only WireGuard
  • task gateway:real swaps in the Inference Gateway with a real provider and model
  • The README shows the same setup against Tailscale (login server, auth keys, policy file)
  • task cleanup removes everything the example created
  • docs/daemon.md "Daemons on other machines" links the example

Activity

  1. added
    enhancement
    on Oct 31, 2026
  2. moved this from Todo to In progress in 2026on Nov 1, 2026
  3. changed the title [-][FEATURE] Add examples/tailscale-peers to secure daemon-to-daemon teleports with Headscale or Tailscale[/-] [+][FEATURE] Add examples/kubernetes-session-teleport-headscale to teleport over a self-hosted Headscale tailnet[/+] on Nov 1, 2026
  4. moved this from In progress to QA in 2026on Nov 1, 2026
  5. inference-gateway-releaser commented on Nov 1, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.240.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  6. moved this from QA to Done in 2026on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions