feat(talos): authenticate kube-apiserver against ZITADEL
The apiserver's live OIDC config still pointed at https://authentik.riotpiao.com/application/o/kubernetes/. Authentik now runs zero pods, so that issuer cannot be discovered and every attempt to login with a token instead of a client certificate fails. The template itself carried no OIDC block at all, so a render would have removed the stale config rather than replace it. Add the ZITADEL issuer, the `kubernetes` client id, and the groups/username claims. Three details had to be verified against a real token first: 1. The issuer is https://zitadel.riotpiao.com with no trailing slash and no /application/o/<app>/ suffix. That suffix belonged to the Authentik scheme; the apiserver compares `iss` by exact string equality. 2. ZITADEL does NOT put profile/email claims in the id_token by default, so `oidc-username-claim: email` resolved to nothing. idTokenUserinfoAssertion is now enabled on the `kubernetes` application. 3. ZITADEL asserts roles as a nested urn claim the apiserver cannot read. The `groupsClaim` action (created alongside this change) mirrors the bare role names into a flat `groups` claim. Verified with a full PKCE authorization-code flow against this client: the id_token carries iss=https://zitadel.riotpiao.com, email, preferred_username and groups=[homelab-admins, ...]. With oidc-groups-prefix=oidc: that maps to the existing ClusterRoleBinding homelab-admin-oidc, which grants cluster-admin. The issuer hostname is pinned in extraHostEntries because the apiserver's static pod resolves through the node's DNS, not cluster CoreDNS; the ingress LoadBalancer serves the publicly-trusted Let's Encrypt wildcard certificate. Client-certificate auth is unchanged, so a wrong value degrades OIDC logins without locking anyone out.
This commit is contained in:
@@ -39,6 +39,9 @@ resource "local_file" "controlplane_configs" {
|
||||
dns_servers = var.cluster_config.dns_servers
|
||||
forgejo_registry_ip = var.forgejo_registry_ip
|
||||
forgejo_hostname = var.forgejo_hostname
|
||||
oidc_issuer_hostname = var.oidc_issuer_hostname
|
||||
oidc_issuer_ip = var.oidc_issuer_ip
|
||||
oidc_client_id = var.oidc_client_id
|
||||
zone = each.value.zone
|
||||
allow_scheduling = each.value.allow_scheduling
|
||||
coredns_corefile = file("${path.module}/files/coredns/Corefile")
|
||||
|
||||
Reference in New Issue
Block a user