Keycloak#
Overview#
Keycloak is the NVIDIA Mission Control identity provider. It issues the OpenID Connect tokens that front-end applications such as Launchpad use to authenticate operators, and it can broker an external OAuth2 identity provider and federate BCM’s LDAP users into the realm. Its realm state persists in a CloudNativePG-backed PostgreSQL cluster, and a one-time realm import applies the NVIDIA Mission Control realm, clients, and federation configuration.
How it works#
Keycloak is delivered as three Argo CD Applications:
keycloakThe KeycloakX identity provider.
keycloak-cnpgIts PostgreSQL database, a CloudNativePG
Clusterreconciled by the sharedcnpg-operator(refer to CloudNativePG).keycloak-config-cliThe realm import that applies the NVIDIA Mission Control realm, its clients, and any OAuth2 broker or BCM LDAP federation you enable.
Keycloak’s admin password, database password, and client secrets come from
OpenBao. You provide them in secrets.yaml (Secrets), not in the values
file. External Secrets and the OpenBao injector deliver them to the workloads
(refer to External Secrets Operator and OpenBao).
Configuration#
Add these settings under the keycloak, keycloakCnpg, and
keycloakConfigCli keys in values.yaml. Each key already carries the pinned
version and syncWave from Installing GitOps-Managed Components; the following fields
are the ones you set. A field shown with a value uses that value as its default
when you omit it.
The keycloak block configures the identity provider.
keycloak:
fqdn: <keycloak-fqdn> # set to your Keycloak host name; defaults to keycloak.dgx-<cluster-name>.nvidia.com
realm: nmc # optional, realm Keycloak serves and the import targets
routeEnabled: true # optional, emit the external Gateway route
serviceMonitorEnabled: false # optional, scrape Keycloak metrics with a ServiceMonitor
realmImportEnabled: false # set true for the standard install; creates the nmc realm and its OIDC clients
oauth2Enabled: false # optional, broker an external OAuth2 identity provider
oauth2Alias: nmc # optional, broker alias used when oauth2Enabled
oauth2BaseUrl: <oauth2-base-url> # set to the external provider base URL when oauth2Enabled
ldapEnabled: false # optional, federate BCM LDAP users into the realm
ldapHost: ldapserver.cm.cluster # BCM LDAP host name; must match its server cert SAN
ldapHostIp: 10.141.255.254 # set to your BCM LDAP server address
fqdn– the Keycloak host name. Defaults tokeycloak.dgx-<cluster-name>.nvidia.com. Set it to your environment’s host name.realm– the realm Keycloak serves and the import targets. Defaultnmc.routeEnabled– emit the external Gateway route. Defaulttrue.serviceMonitorEnabled– scrape Keycloak metrics with a ServiceMonitor. Defaultfalse.realmImportEnabled– run thekeycloak-config-clirealm import. Defaultfalse. Set it totruefor the standard install. The import creates thenmcrealm and thenmc-launchpad,argocd, andargocd-cliOIDC clients that Launchpad and Argo CD single sign-on require. It driveskeycloakConfigCli.enabled.oauth2Enabled– broker an external OAuth2 identity provider. Defaultfalse.oauth2Alias– the broker alias for the external OAuth2 provider. Defaultnmc. Used whenoauth2Enabled.oauth2BaseUrl– the external provider base URL. No default. Set it whenoauth2Enabled.ldapEnabled– federate BCM’s LDAP users into the realm. Defaultfalse. Refer to BCM LDAP authentication (optional).ldapHost– the BCM LDAP server host name, which must match its server certificate SAN. Defaultldapserver.cm.cluster. Used whenldapEnabled.ldapHostIp– the address of your BCM LDAP server. The Keycloak Pod resolvesldapHostto it through ahostAlias, so the server certificate SAN matches. Confirm the address for your cluster. Default10.141.255.254.
The keycloakCnpg block configures the CloudNativePG database.
keycloakCnpg:
instances: 2 # optional, number of PostgreSQL instances
storageSize: 2Gi # optional, per-instance volume size
monitoringEnabled: false # optional, enable CNPG monitoring
instances– number of PostgreSQL instances. Default2.storageSize– per-instance volume size. Default2Gi.monitoringEnabled– enable CNPG monitoring. Defaultfalse.
The keycloakConfigCli block configures the realm import.
keycloakConfigCli:
launchpadRedirectUri: https://<launchpad-fqdn>/* # optional, OAuth redirect URI for the Launchpad client
launchpadWebOrigin: https://<launchpad-fqdn> # optional, OAuth web origin for the Launchpad client
ldapBaseDn: dc=cm,dc=cluster # optional, BCM LDAP users base DN
ldapBindDn: cn=readonlyroot,dc=cm,dc=cluster # optional, BCM LDAP bind DN
launchpadRedirectUri– the OAuth redirect URI for the Launchpad client. Defaults tohttps://<launchpad-fqdn>/*.launchpadWebOrigin– the OAuth web origin for the Launchpad client. Defaults tohttps://<launchpad-fqdn>.ldapBaseDn– the BCM LDAP users base DN. Defaultdc=cm,dc=cluster.ldapBindDn– the BCM LDAP bind DN. Defaultcn=readonlyroot,dc=cm,dc=cluster.
Cross-field consistency rules:
When
oauth2Enabledistrue, bothoauth2Aliasandoauth2BaseUrlmust be non-empty, and you must set the OAuth2 IDP credentials insecrets.yaml.When
ldapEnabledistrue,ldapHostmust be non-empty and must match the BCM LDAP server certificate SAN.When
ldapEnabledistrue,k8s_bootstrap_secrets_ldap_enabledmust also betrueinsecrets.yaml. Refer to BCM LDAP authentication (optional).
Secrets#
Keycloak consumes bootstrap secrets. Leave the admin and database passwords
empty to auto-generate them. The OAuth2 IDP and BCM LDAP blocks are needed only when their
feature is enabled. Add them to secrets.yaml:
k8s_bootstrap_secrets_keycloak_admin_password: "" # Keycloak admin password (user is admin); leave empty to auto-generate
k8s_bootstrap_secrets_keycloak_database_password: "" # PostgreSQL password for the keycloak user; leave empty to auto-generate
# Only when brokering an external OAuth2 identity provider:
k8s_bootstrap_secrets_oauth2_idp_enabled: false
k8s_bootstrap_secrets_oauth2_idp_client_id: <client-id> # required when enabled
k8s_bootstrap_secrets_oauth2_idp_client_secret: <client-secret> # required when enabled
# Only when federating users from BCM LDAP (seed on the BCM head node):
k8s_bootstrap_secrets_ldap_enabled: false
k8s_bootstrap_secrets_keycloak_admin_password– the Keycloak admin password. The user name isadmin. Leave it empty to auto-generate.k8s_bootstrap_secrets_keycloak_database_password– the PostgreSQL password for thekeycloakuser. Leave it empty to auto-generate.k8s_bootstrap_secrets_oauth2_idp_*– the external provider client id and secret. Required whenk8s_bootstrap_secrets_oauth2_idp_enabledistrue.k8s_bootstrap_secrets_ldap_enabled– seed the BCM LDAP bind password and client certificate. Set it together withkeycloak.ldapEnabled. Refer to BCM LDAP authentication (optional).
The Launchpad OIDC client secret is seeded with Keycloak. It is documented on NMC Launchpad.
BCM LDAP authentication (optional)#
BCM publishes its users in an LDAP directory. Keycloak federates that directory into the realm over a mutual TLS connection, so BCM accounts sign in to NVIDIA Mission Control through Keycloak.
These settings federate BCM’s directory. To sign users in from another identity provider,
broker it with oauth2Enabled.
Turn it on in both files:
values.yaml: setkeycloak.ldapEnabled: true, and setldapHostIpto your BCM LDAP server address.secrets.yaml: setk8s_bootstrap_secrets_ldap_enabled: true.
ldapEnabled makes OpenBao expect the LDAP material and the seed creates it, so the
OpenBao configure Job fails when the two disagree.
The realm import generates the rest: the federation provider, its user and group mappers, the Keycloak keystore and truststore wiring, and the host alias.
Operations#
Secret rotation is a direct bao kv put under nmc-admin. The configure
Job’s KV load is create-only and will not overwrite an existing path. A full rotation also requires
changing the value where the component already stored it, because a running component
does not re-read a rotated KV path on its own:
Rotating
keycloak/databasedoes not change the running PostgreSQL password.initdbhonors the password only on first install, so the live password must be changed in PostgreSQL (for example withALTER USER) to match.Rotating the admin or client secrets requires the corresponding Keycloak Admin API update or a
keycloak-config-clirerun.
Warning
Rotating keycloak/realm/<realm>/user-federation/bcm-ldap requires a manual rollout
restart of the KeycloakX workload. The injector renders the LDAP keystore, CA, and bind
material only at Pod start, so the new material does not take effect until the Pod is
recycled.
The BCM LDAP client certificate the seed mints is valid for 365 days. Plan its replacement before it expires. The seed and the configure Job both write once, so replacing the certificate means writing the new material to the KV path directly and restarting the KeycloakX workload.
To add or remove a federated identity source or client, change the keycloak and
keycloakConfigCli settings, seed any new KV path, and rerun the realm import. Refer to
Installing GitOps-Managed Components for the deploy mechanics.
Verify#
Confirm Keycloak:
Confirm the three Keycloak Applications report Healthy in Argo CD:
keycloak,keycloak-cnpg, andkeycloak-config-cli. Thekeycloak-cnpgApplication needs the sharedcnpg-operatorHealthy first.Confirm the CNPG
Clusterreports its instances ready and that thekeycloak-cnpg-cluster-passwordSecret exists in thekeycloaknamespace.Confirm the realm import completed and that the configured
realmand thenmc-launchpad,argocd, andargocd-cliclients are present.When BCM LDAP or OAuth2 is enabled, confirm the federation provider or broker alias appears in the realm.
When BCM LDAP is enabled, Keycloak imports the accounts about five minutes after the realm import creates the federation provider. To import them immediately, open User federation > bcm-ldap and select Action > Sync all users.