Repository navigation
Description
Friction
Off the home network, a workstation cannot reach the cluster's API server: the kubeconfig points at the node's LAN address, so kubectl and every devops k8s command fail with "connection refused". The Cloudflare Tunnel already serves the cluster's web services at *.<domain>, but nothing serves the API.
Evidence
- The tunnel's ingress (
devops cloudflare tunnel routes) holds*.<domain>and<domain>→ Traefik, then the 404 catch-all.k8s.<domain>matches the wildcard, and Traefik has no route for it. - The Access application "Homelab Wildcard Ingress" already gates
*.<domain>(devops cloudflare access status), sok8s.<domain>needs no new application. - An HTTP hostname cannot carry the API: Cloudflare terminates TLS at its edge, which drops kubectl's client certificate. Cloudflare's documented pattern for kubectl is a
tcp://origin reached withcloudflared access tcpon the client, which keeps TLS end to end between kubectl and the API server. k8s/cloudflared/networkpolicy.yamlallows cloudflared egress on 443, 7844 and to Traefik, not 6443.kubernetes.default.svc:443is rewritten to the API server's endpoint on port 6443 before kube-router checks egress, so the policy most likely drops the traffic.k8s/argocd/networkpolicy.yaml(rule 3) shows how other namespaces allow the API server, and lines 43-48 of the cloudflared policy record kube-router's trouble with rules that combineto:andports:.devops cloudflare tunnel syncadds new hostnames after the existing rules, just before the catch-all (src/devops_cli/cloudflare/client.py:145-149). Because cloudflared takes the first matching rule, a host added with it under an existing wildcard is never reached.cloudflaredis not a managed binary: it is absent fromsrc/devops_cli/tools_lock/tools.lockand the devcontainer.
Remedy
- Allow cloudflared egress to the API server on 6443 in
k8s/cloudflared/networkpolicy.yaml, written in the form kube-router enforces, with a test next to the existing network policy tests. - Route
k8s.<domain>totcp://kubernetes.default.svc.cluster.local:443. Fixtunnel syncso that a specific hostname is placed before any wildcard rule that would match it, with a test of the merged order, and record the route ink8s/README.md. - Add
cloudflaredtotools.lockwith sha256-pinned downloads per platform, sodevops install-toolsinstalls it. - Document the workstation side in
k8s/README.md:cloudflared access tcp --hostname k8s.<domain> --url 127.0.0.1:<port>, and a kubeconfig context whose server ishttps://127.0.0.1:<port>withtls-server-name: kubernetes.default.svc, reusing the cluster's credentials. A command that keeps the forward running can follow as its own item.
Pending a person: after the release reaches main, kubectl --context <tunnel-context> get nodes from off the home network returns the nodes after the Access login.
Proposed design
Problem statement
Users cannot access the Kubernetes API server from off the home network because the kubeconfig points to a LAN address, and the Cloudflare Tunnel does not route k8s. to the API server. The tunnel already serves web services at *., but kubectl requires TCP routing through cloudflared access tcp with end-to-end TLS.
Acceptance criteria
- Criterion 1: The network policy allows cloudflared egress to the Kubernetes API server on port 6443
Verification: Runkubectl -n cloudflared get networkpolicy cloudflared-isolation -o yamland verify that a rule exists allowing egress to the API server on port 6443 - Criterion 2: The Cloudflare tunnel routes k8s. to the API server via TCP
Verification: Rundevops cloudflare tunnel routesand verify that a route exists for k8s. pointing to tcp://kubernetes.default.svc.cluster.local:443 - Criterion 3: The tunnel sync command correctly places specific hostnames before wildcard rules
Verification: Rundevops cloudflare tunnel sync --subdomains k8s --service tcp://kubernetes.default.svc.cluster.local:443 --dry-runand verify the hostname is placed before wildcard rules - Criterion 4: cloudflared is available in the devops tools lock
Verification: Check thatsrc/devops_cli/tools_lock/tools.lockcontains a[binary.cloudflared]section with platform-specific entries for all supported platforms - Criterion 5: kubectl can connect to the cluster through the tunnel from off-network
Verification: Runkubectl --context get nodesusing a configured context that uses cloudflared access tcp, and verify it returns the list of nodes after successful Access login
Key questions
- What specific network policy changes are needed to allow cloudflared egress to the API server?: The network policy in
k8s/cloudflared/networkpolicy.yamlneeds to include a rule allowing egress to the API server on port 6443, following the same pattern as existing rules. The rule should use ipBlock with cloud metadata address excluded. [sources: k8s/cloudflared/networkpolicy.yaml] - How does the tunnel sync command currently handle hostname placement?: The tunnel sync command adds new hostnames after existing rules, just before the catch-all, which causes specific hostnames under a wildcard rule to never be reached because cloudflared takes the first matching rule. [sources: src/devops_cli/cloudflare/client.py:145-149]
- Should cloudflared be added to tools.lock?: Yes, cloudflared should be added to
tools.lockwith sha256-pinned downloads per platform so thatdevops install-toolsinstalls it. (proposed)
Open questions
- What is the recommended approach for kubectl access through Cloudflare Tunnel? (missing verified source)
Fit
Needs splitting into 4 items:
- Allow cloudflared egress to the API server in network policy
- Route k8s. to API server through Cloudflare tunnel with proper hostname placement
- Add cloudflared to tools.lock with platform-specific binaries
- Document workstation-side configuration for kubectl access
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 16, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate adds a new capability to reach the kube API off the home network.This improves access convenience but does not block functionality or introduce critical issues.It enables kubectl usage from outside the home network, which is a common need for remote cluster management.Requires changes to network policies, tunnel configuration, tool installation, and documentation.feat(k8s): the kube api is reachable off the home network at k8s.<dom…
feat(k8s): the kube api is reachable off the home network at k8s.<dom…
dan-petty commentedon Oct 16, 2026
Proposal needs splitting into 4 items at 76dd52a (see proposed design in issue body).
dan-petty commentedon Oct 16, 2026
What changed
#1597, merged into
release/v0.2.36as e7f032f.13 file(s) changed.
How it was verified
Check runs at 2221e86:
No task file.
feat(release): v0.2.36 (#1615)
dan-petty commentedon Oct 17, 2026
Verified on 2026-10-17, after v0.2.36 reached
main(3dd7fa6) and Argo CD synced thebaseApplication to it at 12:27 UTC.cloudflared-isolationNetworkPolicy now allows cloudflared egress to the API server on 6443. On 2026-10-16 the same connection was refused at this hop.cloudflared access tcp --hostname k8s.<domain> --url 127.0.0.1:16443running,GET /versionthrough the tunnel reaches the API server. It returns 401, because k3s refuses anonymous requests.kubectl configcommands ink8s/README.md, exactly as written. Through it,kubectl --context <cluster>-tunnel get nodeslists the cluster's nodes, andauth can-i list pods -Aanswers yes.Pending a person: from off the home network, run the listener and
get nodesafter the Access login.