Skip to main content

Identity and secrets

Access
People and credentials are part of the graph

A user is not something you create in an application. It is an attribute of the system, and it propagates to every application the graph says it should reach.

DECLARED · CLIENT SUB-COMPONENTusersusername✉️password:first:lastone line per person+ groups on the providersync jobsON BUILD + DEPLOYidentity providerACCOUNTS · GROUPSfilesmailwikiyour appsingle sign-onaccount made inside the appdrift · the sync jobs never see it
People are declared once, as lines on the identity client. The build syncs them to the identity provider and single sign-on carries them everywhere. An account created inside an app is drift the graph never sees.

Users and groups are declared​

System users live as lines on the identity provider's client sub-component. Groups live on the identity provider itself. Both are ordinary attributes, so both are versioned with the stack, duplicated with it into another environment, and rolled back with it.

Declared asShape
A user, on a client's users attributeusername:email:password:first name:last name, then optional flags, each its own : field
A group, on the Keycloak component's groups attributename:mailing list address:members, members as comma-separated user names
Flag on a user lineEffect
mfaThe user must enrol a one-time-password authenticator; never forced again once enrolled
persistThe password is set when the account is created; after that the user owns it
90d, 6mA rotation window: the user must change the password once it is older; implies persist
noneThe platform owns the password and resets it to the declared value on every sync — unless the Keycloak component sets password_rotation_days, which makes every declared password a first-login seed

A bad line never reaches the cluster: an unknown flag, a duplicate user name or email in one client, a colon or a quote in a password, or a second field that is not an email fails the build with the client, the line and the reason.

On the next build and deploy, synchronisation jobs derive the actual accounts from those lines, and single sign-on carries the identity into every application that has an identity link.

The username is the durable key. Renaming a person changes their display name; it does not create a second account.

Creating users inside an application is drift

An account created directly through an application's own admin interface is invisible to the graph, skipped by the synchronisation jobs, and silently diverging from the declared system. It will appear to work, and then quietly stop matching everything else.

Onboarding and offboarding go through the platform: change the declared user and group lines — through the MCP, with stacktic_attr — then build and deploy.

Who can reach the cluster is declared too​

Access for your own team — to a component's namespace in the cluster — is drawn as well. A user group access component lists user names and group names, one per line; a link from it to a component carries the role:

RoleWhat it allows in that component's namespace
observerRead workloads, services, configuration and secrets
developerAlso create and change them, and read logs
operatorAlso delete them, manage volumes, open a shell and port-forward
adminEverything in the namespace

The build writes the roles and bindings to rbac/ in the stack repository, with a README of who can do what where; apply them with kubectl apply -f rbac/rbac.yaml. Removing the link drops the binding from that file on the next build — delete it from the cluster as well, because applying a file never removes what it no longer lists.

An application does not get a login because someone configured one. It gets a login because there is a link between it and the identity provider — and that link generates the OIDC client, the client secret, the redirect URIs and the application-side configuration together.

Add the link, and the application is behind a login. Remove it, and it is not. There is no third state where the client exists but the application does not know about it.

For an application of your own, the same client link can also put the login in front of it at the gateway: turn on apisix_oidc_enable on its route, and the gateway's openid-connect plugin is built from that client — see Login from a link. The same Keycloak groups decide who may use the stack's MCP server, through its allowed_groups attribute — see Who may use the server.

Extra realms and external identity providers​

The Keycloak component's own realm is the main realm. Two sub-components and three links extend it:

On the graphWhat it is
A realm sub-componentAn extra realm in the same Keycloak: its own users, groups, sessions, password rules and providers
An identity_provider sub-componentAn external OpenID Connect sign-in that Keycloak brokers — Microsoft Entra ID, Okta, Google, ADFS, another Keycloak. Its attributes: alias, discovery_url, client_id, client_secret, client_auth_method, scopes, group_mappings, required_claim, hide_on_login
client-realmThe client and its users live in that realm; without it, the main realm
identity_provider-realmThe provider belongs to that realm; without it, the main realm
identity_provider-clientThat client skips the login page and goes straight to the provider

How the sync treats people and providers:

RuleWhat it means
Provider users belong to the providerKeycloak creates its copy at the first sign-in and refreshes the profile and mapped groups at every sign-in. The sync never writes or deletes them
A declared user who signs in through a provider is handed overOnce Keycloak has linked the two accounts, the local password and passkey are removed, so the provider is the only way in: disable the person there and they are out. Remove the provider from the design and the user is taken back as a declared user
Groups decide access, not the redirectgroup_mappings (claim:value:group) put provider users into declared groups. A client sent straight to a provider is navigation; who may use the application is decided by groups
Nothing is deletedA realm or provider removed from the design is disabled — and a provider hidden — never deleted, because deleting would delete users or their links
An open provider is flaggedA provider without required_claim lets every account it signs in become a user; the build warns and names the realm and its clients. For Entra, tid:<tenant id> or roles:<app role> admits only some
Separation needs a realmClients of one realm share one sign-in session. Tenants that must never meet get their own realm

Register both redirect addresses at the provider — https://<keycloak host>/realms/<realm>/broker/<alias>/endpoint and the same with /logout_response appended. The stack's generated documentation for the Keycloak component lists them, and the sync Job prints them.

A client in an extra realm can be used by your own applications — external source code and image base read the realm from their client link. The other application templates that build their Keycloak settings from a client link still read the main realm, and generation refuses that combination rather than rendering a login that cannot work.

Two ways to hold a secret​

DefaultEncrypted in the repository

Credentials are generated per instance and encrypted at rest in your stack repository. Decryption is local and offline, with a key you hold. Nothing external is required, and the stack installs in an air-gapped environment unchanged.

OptionalSourced from a secret store

Components can instead pull their secrets from an external secret store at runtime. The component declares that it wants this; the operator and the store are components of the stack like anything else.

With the store, three pieces work together:

On the graphWhat it does
The External Secrets component, external_secrets_enabled onThe operator, and the automation that the other components' templates switch on when it is present
external_secrets-openbaoA seed Job writes the stack's secrets into OpenBao — never overwriting a key that already exists — then asks External Secrets to re-read them, so the namespaces receive them at once
openbao-swbucketRaft snapshots of OpenBao into a bucket on the link's backup_schedule, kept backup_retention_days

With the store in place, the attribute only seeds a secret. Rotate the value in the store; a later change of the attribute does nothing.

Both are expressible on the same graph, and the choice is per component rather than all-or-nothing.

A store token is a runtime credential

When secrets come from an external store, the store's access token is held as a design-time attribute. Re-initialising the store therefore leaves the stack presenting a token that no longer exists — and the failure is indirect: the store goes invalid, every secret stops syncing, workloads cannot start, and the symptom you actually see is an application error with no obvious link to secrets.

Two valid recoveries: refresh the attribute with the new token, or switch the affected components back to generating their secrets locally.

Diagnose from the store downwards, never from the broken application upwards:

kubectl get clustersecretstore        # READY must be True
kubectl get externalsecret -A # STATUS must be SecretSynced

Every instance gets its own credential​

A catalog default is written for one instance. The moment a component owns a second sub-component of the same kind — two buckets, three databases, four clients — each one needs its own name, user and secret.

This is enforced at generation time. Two buckets sharing an access key do not produce a subtly wrong stack; they produce a build that stops and tells you which value has to differ.