Skip to content

feat(kubectl-tunnel): expose kube-apiserver via cluster-apps tunnel#14

Merged
xnoto merged 1 commit intomainfrom
feat/kubectl-tunnel
Apr 30, 2026
Merged

feat(kubectl-tunnel): expose kube-apiserver via cluster-apps tunnel#14
xnoto merged 1 commit intomainfrom
feat/kubectl-tunnel

Conversation

@xnoto
Copy link
Copy Markdown
Contributor

@xnoto xnoto commented Apr 30, 2026

Summary

Expose the kube-apiserver as a TCP tunnel through the existing cluster-apps Cloudflare Tunnel so admins can reach `kubectl` from anywhere without VPN, without opening the apiserver to the public internet, and gated on GitHub-org-admin authentication via the Cloudflare Access app already provisioned in tfroot-cloudflare.

`workloads/kubectl-tunnel/tunnel-binding.yaml`

TunnelBinding in `default` ns referencing the `kubernetes` Service:

```yaml
subjects:

  • name: kubernetes
    spec:
    fqdn: k3s.makeitwork.cloud
    protocol: tcp
    target: tcp://kubernetes.default.svc:443
    ```

`workloads/apps/kubectl-tunnel-app.yaml` + `kustomization.yaml`

Standard ArgoCD Application wiring; sync wave 1 (after gitops-operators brings up cloudflare-operator).

Pairs with

Client usage (one-time setup per laptop)

```
brew install cloudflared
cloudflared login # browser OIDC, stores cert
cloudflared access tcp \
--hostname k3s.makeitwork.cloud \
--url localhost:6443 & # backgrounded shim

kubeconfig points at the local shim

kubectl config set-cluster k3s --server=https://localhost:6443 --insecure-skip-tls-verify
```

(Use `--insecure-skip-tls-verify` only if you don't have the apiserver CA pinned; ideally embed the cluster CA cert in the kubeconfig instead.)

Test plan

  • After merge: `kubectl-tunnel` Application Synced + Healthy
  • After merge: `cloudflared access tcp --hostname k3s.makeitwork.cloud --url localhost:6443` opens after GitHub OAuth
  • After merge: `kubectl --server=https://localhost:6443 get nodes` reaches the apiserver

🤖 Generated with Claude Code

TunnelBinding in `default` namespace fronts the kubernetes Service
(kube-apiserver) on k3s.makeitwork.cloud as a TCP tunnel through the
existing cluster-apps Cloudflare Tunnel. Combined with the Cloudflare
Access self-hosted application in tfroot-cloudflare, only authenticated
makeitworkcloud-admins can connect.

Client usage (no VPN required, no apiserver port exposed publicly):

  cloudflared login                # one-time browser OIDC
  cloudflared access tcp \
    --hostname k3s.makeitwork.cloud \
    --url localhost:6443 &
  kubectl --server=https://localhost:6443 …
@xnoto xnoto self-assigned this Apr 30, 2026
@xnoto xnoto closed this Apr 30, 2026
@xnoto xnoto reopened this Apr 30, 2026
@xnoto xnoto merged commit 809209c into main Apr 30, 2026
4 checks passed
@xnoto xnoto deleted the feat/kubectl-tunnel branch April 30, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant