Migrate Sveltos cluster auth from static SA to Kanidm SA + OIDC #1530

Open
opened 2026-08-13 21:22:20 +00:00 by ginjiruu · 2 comments
Owner

Moved from lab/iac#36 — Sveltos auth migration is implemented in this (clusters) repo.

Migrate Sveltos cluster auth from static SA to Kanidm SA + OIDC

Mechanism resolved by lab/iac#38 (Golden Path): no refresh machinery. Sveltos kubeconfigs point at the agentgateway TLS backend and carry the Kanidm SA API token as a static token; agentgateway performs the RFC 8693 token exchange per request. lab/iac#39 resolved (2026-08-12) — exchange verified end-to-end; no conformance blocker remains.

Follow-on to #1531 (Sveltos bootstrap with a static cluster-admin SA). Once the k8s apiserver OIDC flags (#1522) and the Kanidm kubernetes client (lab/iac#35) exist, switch Sveltos's connection to each fleet cluster to a Kanidm service account authenticating via OIDC — same RFC 8693 flow Argo CD and tofu-controller already use — so there are no static long-lived SA credentials on the fleet.

Note: keeping Sveltos on k8s ServiceAccount auth with its built-in tokenRequestRenewalOption was explored and not deemed valid — it renews k8s SA tokens rather than Kanidm tokens. The decision is that all cluster tooling authenticates as Kanidm service accounts (ADR-0006 machine-as-principal). Under the Golden Path this option is simply never needed.

Current state (after #1531)

  • Sveltos connects to each cluster with a cluster-admin SA kubeconfig created by sveltosctl generate kubeconfig --create, stored as a <cluster>-sveltos-kubeconfig Secret in the management cluster (mini).
  • This is the same pattern Argo CD's current cluster secrets use (TLS client certs from a static bootstrap SA).

Target state

  • Each fleet cluster's <cluster>-sveltos-kubeconfig Secret holds a kubeconfig whose auth is a Kanidm OIDC identity (sveltos-<cluster> SA via lab/iac#35), resolved to RBAC through the apiserver's OIDC groups claim.
  • Credential delivery (Golden Path, lab/iac#38): the kubeconfig carries
    users:
    - name: sveltos-<cluster>
      user:
        token: <sveltos-<cluster> SA API token>   # the only secret; per-actor
    clusters:
    - name: <cluster>
      cluster:
        server: https://<agentgateway apiserver route>
        certificate-authority-data: <agentgateway CA>
    
    agentgateway exchanges the SA API token per request and forwards a fresh token to the real apiserver. No exec credential plugin, no expirationTimestamp, no Secret rewrite loop.

Migration path (in place, per cluster)

  1. lab/iac#35: create the sveltos-<cluster> Kanidm SA + kubernetes client.
  2. Stand up the agentgateway apiserver routes (backendAuth.oauthTokenExchange, backendTLS: {}, public client, audiences: [kubernetes], scope: openid groups) — exchange verified (lab/iac#39 resolved 2026-08-12).
  3. Bind the required ClusterRole(s) to the SA's OIDC identity on the cluster (via the capability groups, ADR-0006 model).
  4. Rewrite the <cluster>-sveltos-kubeconfig Secret to the Golden-Path form above.
  5. Verify: sveltosctl show addons still green, ClusterProfiles reconcile, drift detection works.
  6. Delete the bootstrap SA + ClusterRoleBinding.

Acceptance criteria

  • No static long-lived SA credentials remain in fleet-cluster kubeconfigs (the only secret is the per-actor Kanidm SA API token)
  • Sveltos reconciles through OIDC-issued identity; revocation = removing the Kanidm SA (no cluster-state cleanup)
  • No refresh machinery: no exec provider, no stored short-lived token

Depends on / linked

  • lab/iac#38 (Golden Path decision — mechanism) and lab/iac#39 (Kanidm conformance blocker — resolved)
  • #1531 (Sveltos bootstrap) — the base to migrate
  • lab/iac#35 (Kanidm kubernetes client + SAs) — the credential source
  • #1522 (apiserver OIDC flags live)
  • Argo CD's parallel migration (lab/iac#37) shares the same lab/iac#35/#38/#39 prerequisites
> Moved from lab/iac#36 — Sveltos auth migration is implemented in this (clusters) repo. ## Migrate Sveltos cluster auth from static SA to Kanidm SA + OIDC > Mechanism resolved by **lab/iac#38 (Golden Path)**: no refresh machinery. Sveltos kubeconfigs point at the agentgateway TLS backend and carry the Kanidm SA API token as a static `token`; agentgateway performs the RFC 8693 token exchange per request. **lab/iac#39 resolved (2026-08-12)** — exchange verified end-to-end; no conformance blocker remains. Follow-on to #1531 (Sveltos bootstrap with a static cluster-admin SA). Once the k8s apiserver OIDC flags (#1522) and the Kanidm `kubernetes` client (lab/iac#35) exist, switch Sveltos's connection to each fleet cluster to a Kanidm service account authenticating via OIDC — same RFC 8693 flow Argo CD and tofu-controller already use — so there are no static long-lived SA credentials on the fleet. > Note: keeping Sveltos on k8s ServiceAccount auth with its built-in `tokenRequestRenewalOption` was explored and **not deemed valid** — it renews k8s SA tokens rather than Kanidm tokens. The decision is that all cluster tooling authenticates as Kanidm service accounts (ADR-0006 machine-as-principal). Under the Golden Path this option is simply never needed. ## Current state (after #1531) - Sveltos connects to each cluster with a cluster-admin SA kubeconfig created by `sveltosctl generate kubeconfig --create`, stored as a `<cluster>-sveltos-kubeconfig` Secret in the management cluster (mini). - This is the same pattern Argo CD's current cluster secrets use (TLS client certs from a static bootstrap SA). ## Target state - Each fleet cluster's `<cluster>-sveltos-kubeconfig` Secret holds a kubeconfig whose auth is a Kanidm OIDC identity (`sveltos-<cluster>` SA via lab/iac#35), resolved to RBAC through the apiserver's OIDC `groups` claim. - **Credential delivery (Golden Path, lab/iac#38):** the kubeconfig carries ```yaml users: - name: sveltos-<cluster> user: token: <sveltos-<cluster> SA API token> # the only secret; per-actor clusters: - name: <cluster> cluster: server: https://<agentgateway apiserver route> certificate-authority-data: <agentgateway CA> ``` agentgateway exchanges the SA API token per request and forwards a fresh token to the real apiserver. **No exec credential plugin, no `expirationTimestamp`, no Secret rewrite loop.** ## Migration path (in place, per cluster) 1. lab/iac#35: create the `sveltos-<cluster>` Kanidm SA + `kubernetes` client. 2. Stand up the agentgateway apiserver routes (`backendAuth.oauthTokenExchange`, `backendTLS: {}`, public client, `audiences: [kubernetes]`, `scope: openid groups`) — exchange verified (**lab/iac#39 resolved 2026-08-12**). 3. Bind the required ClusterRole(s) to the SA's OIDC identity on the cluster (via the capability groups, ADR-0006 model). 4. Rewrite the `<cluster>-sveltos-kubeconfig` Secret to the Golden-Path form above. 5. Verify: `sveltosctl show addons` still green, ClusterProfiles reconcile, drift detection works. 6. Delete the bootstrap SA + ClusterRoleBinding. ## Acceptance criteria - [ ] No static long-lived SA credentials remain in fleet-cluster kubeconfigs (the only secret is the per-actor Kanidm SA API token) - [ ] Sveltos reconciles through OIDC-issued identity; revocation = removing the Kanidm SA (no cluster-state cleanup) - [ ] No refresh machinery: no exec provider, no stored short-lived token ## Depends on / linked - lab/iac#38 (Golden Path decision — mechanism) and **lab/iac#39** (Kanidm conformance blocker — **resolved**) - #1531 (Sveltos bootstrap) — the base to migrate - lab/iac#35 (Kanidm `kubernetes` client + SAs) — the credential source - #1522 (apiserver OIDC flags live) - Argo CD's parallel migration (lab/iac#37) shares the same lab/iac#35/#38/#39 prerequisites
Author
Owner

Note: machine flow for Sveltos via Kanidm SA API token -> TokenExchange now validated end-to-end for mini/portable (same mechanism ArgoCD/tofu-controller will use). Golden Path kubeconfig (server https://.k8s.animeteamspeak.moe + token) works for get/exec. Ready to migrate -sveltos-kubeconfig Secrets once #1538 rolls out.

Note: machine flow for Sveltos via Kanidm SA API token -> TokenExchange now validated end-to-end for mini/portable (same mechanism ArgoCD/tofu-controller will use). Golden Path kubeconfig (server https://<cluster>.k8s.animeteamspeak.moe + token) works for get/exec. Ready to migrate <cluster>-sveltos-kubeconfig Secrets once #1538 rolls out.
Author
Owner

Terminology correction (agentgateway → current architecture). The apiserver access path is no longer agentgateway. It's the k8s-hub (Cilium Gateway API) + the custom authz-bridge (CRDs in oauth.animeteamspeak.moe / providers.animeteamspeak.moe) which performs the RFC 8693 token exchange. agentgateway is now AI-only.

So in this ticket, "agentgateway" → the k8s-hub / authz-bridge:

  • "kubeconfigs point at the agentgateway TLS backend… agentgateway performs the RFC 8693 token exchange per request" → "kubeconfigs point at the k8s-hub route (<cluster>.k8s.animeteamspeak.moe); the authz-bridge performs the RFC 8693 exchange."
  • "Stand up the agentgateway apiserver routes (backendAuth.oauthTokenExchange, backendTLS: {}…)" → "the k8s-hub apiserver routes + the authz-bridge OidcPolicy/TokenExchangePolicy (oauth.animeteamspeak.moe)."
  • "server: https://" → "https://.k8s.animeteamspeak.moe (the k8s-hub route)."
**Terminology correction (agentgateway → current architecture).** The apiserver access path is no longer agentgateway. It's the **k8s-hub** (Cilium Gateway API) + the custom **authz-bridge** (CRDs in `oauth.animeteamspeak.moe` / `providers.animeteamspeak.moe`) which performs the RFC 8693 token exchange. agentgateway is now AI-only. So in this ticket, "agentgateway" → the k8s-hub / authz-bridge: - "kubeconfigs point at the agentgateway TLS backend… agentgateway performs the RFC 8693 token exchange per request" → "kubeconfigs point at the k8s-hub route (`<cluster>.k8s.animeteamspeak.moe`); the authz-bridge performs the RFC 8693 exchange." - "Stand up the agentgateway apiserver routes (`backendAuth.oauthTokenExchange`, `backendTLS: {}`…)" → "the k8s-hub apiserver routes + the authz-bridge `OidcPolicy`/`TokenExchangePolicy` (`oauth.animeteamspeak.moe`)." - "server: https://<agentgateway apiserver route>" → "https://<cluster>.k8s.animeteamspeak.moe (the k8s-hub route)."
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/clusters#1530
No description provided.