Plan: hub architecture — portable as hub, WireGuard mesh + Cilium Gateway API edge + shared CA #1532
Labels
No labels
epic
fleet:hub
fleet:identity
fleet:ingress
fleet:offload
fleet:sveltos
needs-triage
ready-for-agent
ready-for-human
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/clusters#1532
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hub architecture plan: portable as hub — WireGuard mesh + agentgateway ingress + shared CA
End-state architecture for the fleet: one hub cluster with a public IP, WireGuard between sites, agentgateway as the single ingress for every cluster, Cilium ClusterMesh over the WG fabric, Kanidm as the identity store, shared CA with Vault as authority. This ticket is the plan; implementation lands as child tickets. Supersedes the OCM adoption discussion — OCM's tunnel is rejected; we build the tunnel ourselves.
Goal
Any client with internet access and a valid Kanidm identity can reach any cluster's Kubernetes API, authenticated and audited, over
<cluster>.k8s.animeteamspeak.moe. All "client" access (argocd, vault, sveltos, tofu-controller, humans) goes through agentgateway.Decisions
D1. Hub = portable
Portable holds the public IP and is the WireGuard coordination point + the single agentgateway ingress for all clusters. Portable is currently resource-starved → running workloads move off portable onto mini as part of this plan. mini is not publicly reachable; it joins as a spoke.
D2. WireGuard/UDP everywhere (assumption)
Assumption: WireGuard/UDP works at all current target sites. If a site turns out TCP-egress-only, revisit (frp/rathole for L4, UDP-over-TCP shim or L3 alternative for ClusterMesh). Not yet validated per site.
D3. Shared CA, Vault as authority
All clusters share one apiserver CA. Vault is the CA authority (tried and tested). cert-manager trust-manager distributes the CA bundle; agentgateway trusts the shared CA for
backendTLS. One bundle, one trust policy.Because the CA is shared, it must be pre-seeded into every cluster before the first server starts (RKE2 generates its own CA at first start and will not adopt one afterward without a disruptive re-sign):
/var/lib/rancher/rke2/server/tls/by the machine-configs rke2 module beforerke2-serverstarts (nix repo requirement R7).backendTLSis post-bootstrap via Vault → trust-manager; the CA key never leaves sops / Vault IaC.D4. OIDC flags on every apiserver
Every apiserver carries the OIDC flags from #1522 (issuer, client-id, groups-claim, username-claim) and grants by capability groups (iac#2 / ADR-0006). This is a machine-configs change (
kube-apiserver-arg), not an agentgateway concern.D5. Single public endpoint per cluster, dual auth
Public URL per cluster:
<cluster>.k8s.animeteamspeak.moe. One endpoint serves both flows:Assumption: agentgateway supports multiple auth configurations on a single endpoint (precedent: kgateway / envoy-gateway). Validate; expected upstream if not present today.
D6. WebSocket/SPDY validation
kubectl
exec/logs/port-forwarduse connection upgrades. konnectivity only solves hub→spoke, not client→cluster, so the client→cluster upgrade path must work through agentgateway. Validate before depending on it.D7. DNS
<cluster>.k8s.animeteamspeak.moerecords managed via the existing external-dns config. Portable is the single gateway → a fallback*.k8s.animeteamspeak.moerecord covers new clusters until per-cluster records exist.D8. Audit
Audit was an offhand comment about what this architecture yields — a capability, not a v1 commitment. Out of scope for the plan.
D9. Bootstrap requirements → machine-configs
The Nix bootstrap requirements this plan imposes are written to the machine-configs repo (
docs/architecture-requirements.md). See pointer under Bootstrap.D10. Shared site network — own ticket
A proper shared-site-network address plan (WG overlay vs routed site LANs;
tls-san;ipv4NativeRoutingCIDR) is tracked as its own ticket: #1533.Architecture
Topology
Connectivity planes
Auth flows
kubernetesservice indefaultis not a ClusterMesh global service (control-plane owned; unsupported).Certificates
*.k8s.animeteamspeak.moe; no client-side CA distribution.backendTLStrusts it;serverNamematches the internal SAN agentgateway dials (service name / VIP / WG address).Bootstrap pipeline (machine-configs)
Written to
docs/architecture-requirements.mdin the machine-configs repo. Summary of the new pieces: OIDC flags (#1522),tls-sanfor the backend-dialed address, WG peer config + per-host keys (sops), tunnel client for firewalled/dev sites (frp/rathole), first-boot sops identity (SSH-host-key age + keys baked into the installer ISO), and the one-time CA export (rke2 server CA → Vault → trust-manager). The CA export is runtime, not Nix.Open items / child tickets
Related
Related new workstream (2026-08-18):
plans/portable-offload-migration.md+ #1537 (scope refined) + #1540 (backup-harness gate).Refines D1: portable becomes the fleet's head management cluster — it keeps only management (forgejo, vault, harbor, kanidm) + networking/edge, and runs no web workloads. Everything else moves to mini (or standby/), gated on a file-based local-directory backup that is restore-tested (Velero kept as untrusted offsite copy only). This is what frees the capacity the hub roles (D2/D5/D6, #1533/#1534/#1535/#1538) need on portable.
One open call this raises for the hub: where Sveltos lives — see the comment on #1531.
Update D5/D6: single-endpoint dual-auth and upgrades validated, no fork needed.
Terminology correction (agentgateway → current architecture). The plan's "agentgateway as the single ingress for every cluster" is superseded. The live architecture is:
gateway/cilium-default); haproxy is removed.oauth.animeteamspeak.moeCRDs) doing the RFC 8693 exchange.clusters/portable/ai/).So throughout this plan, "agentgateway" (as the single ingress / apiserver proxy / token-exchange component) → Cilium Gateway API (edge) and k8s-hub + authz-bridge (apiservers). E.g. title "agentgateway ingress" → "Cilium Gateway API edge"; D3 "agentgateway trusts the shared CA for backendTLS" → the k8s-hub gateway/authz-bridge; D5 "agentgateway supports multiple auth configurations on a single endpoint / agentgateway exchange / passes it through" → the k8s-hub (Cilium + authz-bridge); D6 "exec/logs/port-forward through agentgateway" → through the k8s-hub; "Implement agentgateway as hub ingress (D5/D6) — #1538" → the Cilium edge / k8s-hub. (#1527, the edge research this fed, was closed as superseded by the Cilium Gateway API edge.)
Plan: hub architecture — portable as hub, WireGuard mesh + agentgateway ingress + shared CAto Plan: hub architecture — portable as hub, WireGuard mesh + Cilium Gateway API edge + shared CAClosing as superseded: portable is gone, cross-site links are NetBird (lab/iac ADR-0008), certificates come from OpenBao (lab/iac ADR-0009), and every child ticket is closed.
Reopened: the user reviewed the triage on 2026-11-22 and keeps the hub plan. It isn't incompatible with NetBird (iac ADR-0008), and Sveltos is still planned. The superseded close was a parallel session acting on the unreviewed proposal.