How Keycloak signs your team into Rancher
Rancher supports Keycloak through both OIDC and SAML, and Rancher describes the two methods as functionally equivalent, so the choice between them is mainly about what your platform team already operates and supports. This section covers the build of that sign-in path, not vendor licensing. For the OIDC route, Rancher expects a confidential Keycloak client whose redirect URI is https://<rancher-host>/verify-auth, and three mappers on that client's dedicated scope: a groups Group Membership mapper, an Audience mapper and a full_group_path mapper. Decide early which method you will run, because the client, mappers and endpoint settings differ between the two and switching later means reworking the Keycloak configuration.
Once a user signs in, Rancher reads the groups it receives from Keycloak and uses them to decide what that person may do in Rancher and in the clusters it manages. Group names therefore carry access decisions, so agree on the group structure in Keycloak before you map anything, and confirm with your team which group path format Rancher will match against. Users and groups that need to search Keycloak from within Rancher also require the query-users, query-groups and view-users roles, which is a separate access decision from ordinary sign-in. Ask whoever will administer Rancher to test these roles with a non-administrative account before rollout. Confirm the exact endpoint behavior for your Keycloak version in the Rancher documentation, since Keycloak 17 and later need endpoints entered manually rather than generated.
What you need before configuring Rancher and Keycloak
Rancher and Keycloak only work together when both sides agree on versions, hostnames, trust and identity structure before anyone clicks through the Rancher authentication settings. The cards below cover the decisions and checks that prevent most failed first sign-ins. Confirm each item in your own environment before the configuration work starts.
Keycloak version 17 or later
Rancher's Keycloak setup expects Keycloak 17 or newer. For these versions, enter the OIDC or SAML endpoints using the Specify option, because the Generate option adds the older /auth path that newer Keycloak releases no longer use. The current Keycloak release is 26.8.1. Confirm which Keycloak and Rancher versions you will run together in your own environment, and check that combination against Rancher's supported versions before you start.
Rancher Keycloak docsSupported production database
Keycloak should run against a supported production database, not the default development file database. Confirm the database version against Keycloak's supported list, plan backups and restore tests for it, and decide who owns it. A Keycloak outage stops every Rancher sign-in, so the database and its recovery plan are part of the SSO design, not an afterthought.
Keycloak database guideTLS on both hostnames
Serve Keycloak and Rancher over HTTPS with certificates issued for their final hostnames. Rancher redirects users to Keycloak and back to its /verify-auth path, so both endpoints must be reachable by the user's browser and trusted by it. Keycloak's production guide expects TLS on all communication, so check the reverse proxy and load balancer configuration in front of both services.
Certificate trust for Rancher
Rancher must trust the certificate chain presented by Keycloak, especially when the Keycloak certificate comes from an internal certificate authority. Confirm that the CA bundle is available to Rancher and that the chain is complete, since a missing intermediate certificate often shows up only as a failed login. Record who owns certificate renewal for each hostname.
Admin account in the target realm
Create or identify an administrator in the realm that will serve Rancher, not only in the Keycloak master realm. This account configures the client, mappers and roles. Apply the Rancher-required roles query-users, query-groups and view-users to the users or groups that must search Keycloak from Rancher, and document who holds that access.
Users and groups that match Rancher roles
Plan the Keycloak group structure before configuration. Groups in Keycloak feed the groups claim, which Rancher uses to map identities to its access roles. Decide which groups map to cluster and global roles, confirm that group names are stable, and check that the full group path mapper produces the values your Rancher role assignments expect. Confirm the mapping in a test realm first.
Choosing OIDC or SAML for the Rancher login
If your Kubernetes tooling already signs in through OpenID Connect, Rancher's OIDC option usually fits the existing pattern best. Your team will already know how clients, redirect URIs and scopes are handled in Keycloak, and the Rancher setup follows the same model: a confidential client, a redirect URI of https://<rancher-host>/verify-auth and mappers on the client's dedicated scope.
- Shared client pattern: Other clusters, CI tools or dashboards may use OIDC clients in the same realm, so one set of conventions covers them all.
- Token claims: Group, audience and full group path values arrive as token claims that your team can inspect with standard OIDC tooling.
- Endpoint entry: For Keycloak 17 and later, enter the endpoints with the Specify option, because Generate adds the older
/authpath. - Client secret handling: The confidential client needs a secret that must be stored and rotated under your own secrets process.
- Mapper upkeep: The groups, Audience and full_group_path mappers must stay aligned with what Rancher expects after any Keycloak change.
Before you choose, confirm with your platform team that the mapper set and the Specify endpoint entries are documented in your runbook.
If your organization has standardized on SAML 2.0 for application sign-in, choose Rancher's SAML option so the Rancher login follows the same federation pattern as your other enterprise applications. Rancher describes this method as functionally equivalent to OIDC, so the decision is about fit with your existing practice, not a difference in what the login can do.
- Certificate lifecycle: SAML trust depends on signing certificates and metadata, so you need a process for renewing and replacing them before they expire.
- Metadata exchange: Confirm how the Keycloak SAML client metadata will reach Rancher and who approves changes to it.
- Existing SAML tooling: Auditors and identity teams who already review SAML configurations can apply the same checks to this client.
- Attribute mapping: Identify which attributes carry user name, email and group membership, and document the mapper for each.
- Change control: Each certificate or endpoint change needs a tested rollback, because a broken trust relationship blocks every Rancher sign-in at once.
Confirm the exact SAML settings and supported options with Rancher's current authentication documentation before you commit to this path.
If cluster and project access must follow Keycloak group membership, the decision depends on which mappers you can maintain reliably and how group names will be read. Rancher's OIDC setup uses a groups Group Membership mapper and a full_group_path mapper, which determine how group identities appear in tokens. Plan the group model first, then select the method that lets your team maintain those mappings with confidence.
- Group naming: Decide whether groups are flat or nested, because the full group path changes how a group name appears in Rancher.
- Search permissions: Users or groups that must search Keycloak from Rancher need the query-users, query-groups and view-users roles.
- Role ownership: Assign who in Keycloak creates and removes groups, since those changes flow into cluster access.
- Testing: Sign in with test accounts from each group before rolling out production cluster roles.
- Documentation: Record each mapper and group path so auditors and on-call staff can trace access.
Ask your Rancher and Keycloak administrators to confirm in writing which mapper set each method requires in your version.
How to configure the Keycloak client for Rancher OIDC
This sequence produces a confidential Keycloak client that Rancher can use for OIDC sign-in, with the redirect URI, endpoints and token claims that Rancher needs to map users and groups. Each step ends with a check so the team knows the client is ready before Rancher is changed.
Confirm the Rancher host and realm
Before opening the Keycloak admin console, record the exact public hostname Rancher will use, since the redirect URI must match it character for character. Choose the realm that will hold Rancher users and groups, and confirm that the realm's issuer URL is reachable from the Rancher server and from user browsers. The platform team should agree this with the Keycloak owner in writing. The step is done when the hostname, realm name and issuer URL are written down and the issuer URL loads in a browser over HTTPS.
Create the confidential client
In the target realm, create a new OpenID Connect client for Rancher and turn on client authentication so it is a confidential client with a client secret. Keep the standard authorization code flow enabled and disable flows that Rancher does not use. The Keycloak administrator generates the client secret and stores it in the team's secrets manager, not in tickets or chat. The step is done when the client appears in the realm's client list with client authentication switched on and the secret is recorded in the approved store.
Set the redirect URI and endpoints
Set the valid redirect URI to https://<rancher-host>/verify-auth, replacing the placeholder with the Rancher hostname confirmed in the first step. For Keycloak 17 and later, enter the authorization, token, user info and issuer endpoints with the Specify option rather than Generate, because Generate adds the older /auth path that newer Keycloak releases do not use. The team should confirm each endpoint against the realm's well-known OpenID configuration document. The step is done when the redirect URI matches exactly and every endpoint value matches the discovery document.
Add the groups, audience and full group path mappers
Open the client's dedicated scope and add three mappers. Add a Group Membership mapper that emits a groups claim, an Audience mapper that adds the Rancher client to the token audience, and a full_group_path mapper so that group names carry their full path. Check the mapper settings against Rancher's documentation for the claim names it expects. The step is done when all three mappers appear on the dedicated scope with the intended claim names and no duplicate mapper exists for the same claim.
Grant search roles to users or groups
If Rancher users or groups must search Keycloak when assigning access, give them the query-users, query-groups and view-users roles from the realm management client. Assign these roles to a specific group that Rancher administrators belong to, not to every authenticated user, and record which group holds them. The Keycloak administrator makes this change. The step is done when a test user in the granted group can list users and groups in the Keycloak admin API, and a user outside that group cannot.
Verify the discovery endpoint and test token claims
From a host that can reach Keycloak, request the realm's OpenID discovery document and confirm that it resolves and lists the endpoints entered in the earlier step. Then sign in as a test user with a group membership, using a browser or a token request, and decode the ID token. The token should contain the groups claim, the Rancher client in the audience, and the full group path value. The step is done when the discovery document loads and the decoded token shows all three expected claims for the test user.
Configure the Rancher authentication provider
In Rancher's global authentication settings, select Keycloak (OIDC) and enter the issuer or discovery values, the client ID, the client secret from the secure store, and the group settings that match the claim names in the mappers. Keep a local administrator account active until sign-in is proven, so the cluster remains reachable if the provider fails. The Rancher administrator saves the configuration. The step is done when Rancher accepts the provider settings and the local administrator can still sign in.
Test a login and confirm group access
Sign in to Rancher as a test user through Keycloak, then check that the user receives the access that the mapped group should grant. Test one user in the granted group and one user outside it, and confirm that the second user is denied. Review the Keycloak event log for the attempts and record the results. Repeat the test after any change to mappers or groups. The step is done when both test users behave as expected and the results are recorded for the change record.
Mapping Keycloak groups and roles to Rancher access
This table pairs each Keycloak claim, mapper and role with what Rancher expects from it, the setting that carries it, and the check to run before users sign in. Read it row by row during client setup, then repeat the checks with a test user from each group. The main takeaway is that group naming must be agreed with the Rancher administrators before rollout, because the group values Keycloak sends are what Rancher matches against access roles.
| Item | Keycloak source | Rancher target | Check before rollout |
|---|---|---|---|
| Groups claim | Group Membership mapper on the client's dedicated scope, adding group names to the token | Group values used to assign global and cluster roles in Rancher | Decode a test token and confirm the groups claim lists the expected group names for that user |
| Audience claim | Audience mapper on the dedicated scope, setting the Rancher client as an audience in the token | Token accepted by Rancher as intended for its client | Confirm the aud value in a test token matches the client ID configured in Rancher |
| Full group path | full_group_path mapper, which sends the full path of nested groups rather than only the short name | Group matching for nested Keycloak groups, where the path must match the value Rancher was configured to expect | Compare a nested group's value in the token with the name agreed for the Rancher role binding |
| Group naming convention | Keycloak group names and hierarchy chosen by the identity team | Role bindings in Rancher keyed on those exact names | Written agreement with Rancher admins on naming, case, separators and nesting before any group is created |
| query-users role | Client service account or group with the query-users role in the Keycloak realm management client | Rancher user search when adding members to clusters or projects | Test a user search in Rancher with a non-admin account to confirm results return |
| query-groups role | Same service account or group with the query-groups role | Rancher group search when binding Keycloak groups to access roles | Search for a known group name in Rancher and confirm it appears in the results |
| view-users role | Role granted so Rancher can read user details | Display of user names and attributes in Rancher member lists | Confirm a searched user shows the expected name and email in Rancher |
| Least privilege for search roles | Only the query and view roles the search needs, not realm admin | Limits the account Rancher uses to read Keycloak | Review the role assignments in Keycloak and remove any broader realm management rights |
Why Keycloak 17 and later need manual endpoint settings
Enter the authorization, token, userinfo and issuer endpoints by hand using the Specify option, not Generate. Rancher's Generate option derives the endpoints from the Keycloak host and adds the older /auth path segment. Keycloak 17 and later serve endpoints without that prefix on many layouts, so generated values often point at paths that return errors, and sign-in fails after the Keycloak login page appears to work. The safe pattern is to copy each value from the realm's OpenID configuration document, not from memory or from an older Rancher example.
Verify each endpoint before saving the Rancher form. Open the discovery document for your realm (the well-known OpenID configuration path under the realm URL) and compare the authorization_endpoint, token_endpoint, userinfo_endpoint and issuer values character by character with what you enter. Confirm the issuer matches exactly, including scheme, host and realm name, because a trailing slash or a different hostname is enough to break token validation. Your Keycloak version determines the layout, so confirm the path shape against your own server rather than a published example.
A reverse proxy that rewrites paths changes the answer. Keycloak's production guidance expects a reverse proxy with path restrictions and a clear split between public frontend URLs and the admin endpoints. If the proxy strips or adds a prefix, the discovery document can advertise URLs that Rancher's pods or browsers cannot reach, or that differ from the issuer. Ask the team that runs the proxy to confirm the public hostname Keycloak advertises, and retest the discovery document after every proxy or ingress change, because a passing sign-in last month does not prove the current routing is correct.
Security settings that protect Rancher logins
Rancher sign-in through Keycloak is only as strong as the client, the network path and the permissions behind it. The cards below cover the settings that connect Keycloak, Rancher and the Kubernetes clusters Rancher manages, and the checks to run before any group receives access.
Protect the confidential client secret
The Rancher OIDC setup uses a confidential Keycloak client, so the client secret is a credential that Rancher must hold securely. Store it in a secrets manager or a restricted Rancher configuration path rather than in shared runbooks, limit who can read or regenerate it in Keycloak, and plan a rotation step that updates Rancher at the same time. Confirm who can view the client settings in the Keycloak admin console.
Rancher Keycloak docsServe all traffic over TLS
Keycloak's production guide calls for TLS on all communication, and the Rancher login flow sends tokens and redirects between the browser, Keycloak and Rancher. Confirm that the Keycloak frontend, the Rancher hostname and every internal hop that carries authentication traffic use valid certificates. Check that the redirect URI for Rancher uses https and that certificate renewal is part of the operations runbook.
Keycloak production guideSeparate the admin hostname
Keycloak's production guide recommends exposing the admin console and Administration REST API on a different hostname or context path from public frontend URLs. Rancher only needs the public frontend for sign-in, so the admin surface can stay on an internal name reachable from administrator networks. Confirm the reverse proxy blocks admin paths on the public hostname and test that Rancher's discovery and token endpoints still resolve correctly.
Production configurationLimit the query roles
Rancher needs the query-users, query-groups and view-users roles only for users or groups that search Keycloak from Rancher. Grant them to a narrow set of Rancher administrators rather than to every authenticated user, and review the assignments whenever administrators change roles. Record which accounts hold these roles so that a directory search cannot expose the whole realm to people who never needed it.
Apply least-privilege RBAC to mapped groups
Groups that Rancher maps from Keycloak become bindings in each downstream cluster, so a broad group grants broad access everywhere it is assigned. Map each Keycloak group to the narrowest Rancher role that does the job, and avoid cluster-admin for general groups. Note that Kubernetes Secrets are stored unencrypted in etcd by default, so confirm that encryption at rest is enabled for every cluster Rancher manages and that list and watch access on Secrets is restricted.
Kubernetes Secrets practicesKeep a local break-glass admin
If Keycloak is unreachable, expired or misconfigured, Rancher sign-in through SSO fails for everyone. Keep a local Rancher administrator account with a strong, separately stored credential and test that it works before the SSO change goes live. Limit its use to recovery, log each sign-in, and review the account on a set schedule so that the escape hatch does not become a shared everyday login.
Common Rancher and Keycloak login failures
This table lists the login and search failures teams most often hit when connecting Rancher to Keycloak, with the likely cause, the check to run and the fix for each. Work down the rows in order, because a redirect or endpoint error blocks every later check.
| Symptom | Likely cause | Check and fix |
|---|---|---|
| Redirect URI mismatch on /verify-auth | The Keycloak client's valid redirect URI does not match the Rancher host exactly, often because of a different hostname, scheme or missing path. | Confirm the client redirect URI is https://<rancher-host>/verify-auth using the exact host users browse to. Correct the client in Keycloak, then retry sign-in. |
| Endpoints contain /auth on Keycloak 17 or later | The Generate option was used, which adds the older /auth path that Keycloak 17 and newer do not serve. | Reopen the Rancher Keycloak OIDC configuration and switch the endpoint fields to the Specify option. Re-enter the issuer and endpoint URLs without /auth, then save and test. |
| Groups missing from the token | The groups Group Membership mapper was added to the wrong scope, so the claim never reaches the ID or access token Rancher reads. | Open the client's dedicated scope, not a shared client scope, and confirm the groups, Audience and full_group_path mappers exist there. Sign out, sign in again and inspect the token claims. |
| Group-based access does not apply | The full_group_path or groups mapper emits names that do not match the group names or paths granted in Rancher. | Compare the claim values in a fresh token with the group names in Rancher. Adjust the mapper settings or the Rancher group bindings so they match exactly. |
| User or group search fails in Rancher | The user lacks the query-users, query-groups or view-users roles on the Keycloak side, so Rancher cannot search for principals. | In Keycloak, grant the query-users, query-groups and view-users roles to the service account or user Rancher uses for searches. Test a search in Rancher after the change. |
| TLS trust error on Keycloak endpoints | Rancher cannot verify the certificate chain of the Keycloak HTTPS endpoint, often because the issuing CA is internal and not trusted by Rancher. | Confirm the Keycloak certificate chain is valid and that Rancher trusts the issuing CA. Install the CA where Rancher requires it, then retest the discovery and token endpoints. |
| Sign-in loops back to the login page | The client secret, issuer URL or endpoint settings are inconsistent, so the token exchange fails after the Keycloak redirect. | Verify the client is confidential, the client secret matches the Rancher configuration and every endpoint points to the same realm. Review the Rancher and Keycloak logs for the failed exchange. |
How a Rancher login travels through Keycloak
The login starts in the user's browser at the public Rancher hostname, which redirects the user to the Keycloak realm for authentication. Keycloak returns the user to the /verify-auth endpoint on the Rancher host, where Rancher reads the groups, audience and full group path claims from the tokens. Check that the redirect URI matches exactly and that those three mappers are on the client's dedicated scope, because Rancher applies the claims to cluster access.
Redirect path from the Rancher host through the Keycloak realm and back to verify-auth.
Questions buyers ask before configuring Rancher SSO with Keycloak
Can a platform team set up Rancher SSO with Keycloak on its own?
Yes, a platform team with Kubernetes, Rancher and Keycloak administration experience can usually do it in-house, because the Rancher setup is a single confidential client, a redirect URI and three mappers. The skills that matter are Keycloak realm and client administration, Rancher global authentication settings, and enough Kubernetes RBAC knowledge to map groups to cluster roles. The harder part is the design work: deciding which Keycloak groups map to which Rancher and cluster permissions, and testing that a user in each group gets the access you intended. If nobody on the team has run Keycloak in production, plan time to learn its admin model before you start.
How does effort change with the number of groups and clusters?
The number of Rancher clusters matters less than the number of group-to-role decisions, because the Keycloak client and mappers are configured once per Rancher installation. Each additional group adds a mapping that must be designed, documented and tested, and each cluster adds a set of permissions to verify. Query-users and query-groups roles also need to be assigned to every group or user that searches Keycloak from Rancher, so a large directory with many teams adds review work. Ask any partner to show how the group model scales and what testing covers each mapped group.
What drives the cost of outside help for Rancher SSO?
Cost follows the written scope, and the main drivers are the number of environments (for example, separate test and production Rancher and Keycloak instances), the complexity of the group and role mapping, the amount of testing you require, and whether Keycloak itself needs hardening or a realm design first. A quote should list who does each task, whether the work is one-time or includes ongoing support, and what the client must provide. DeployOpen does not publish a price list, and most engagements are fixed-scope with scope, deliverables and timelines agreed in writing before work starts. Ask for each environment and each mapping rule to be listed as a line item.
How long does Rancher SSO with Keycloak take to set up?
The duration depends mainly on how mature your Keycloak deployment already is. If Keycloak is running, has TLS, a stable realm and groups that already reflect your access model, the Rancher configuration itself is a bounded task. If Keycloak is new, needs a realm design, or lacks a tested backup and admin recovery path, that work adds time before Rancher is involved. No duration is given here because none is supplied for this topic, so ask any provider for a timeline tied to a written scope and confirm which Keycloak prerequisites are already met in your environment.
What must our team provide before the engagement starts?
Your team needs to supply the realm design decisions, the hostnames for Keycloak and Rancher, and the certificates that both services will use. You also need to decide the group structure, which groups receive query-users, query-groups and view-users roles, and which Rancher roles or cluster permissions each group should have. Access to the Keycloak admin console, the Rancher management cluster and an approved test environment is also required. Confirm in the quote who owns the certificate issuance and renewal, because Rancher must reach Keycloak over trusted TLS, and who approves the mapping design.
Should we choose OIDC or SAML for Rancher and Keycloak?
Rancher describes OIDC and SAML as functionally equivalent for Keycloak, so the choice is usually driven by your existing standards and operational habits rather than by Rancher features. OIDC uses a confidential client with the verify-auth redirect URI and the three mappers described in the Rancher documentation, while SAML uses its own client configuration. Whichever you pick, your team must confirm how group claims reach Rancher and test that the full group path mapper behaves as expected. Confirm the choice with your security team and document it before configuration starts.
What goes wrong most often when connecting Rancher to Keycloak?
The most common problems are an endpoint configured with the Generate option on Keycloak 17 or later, which adds the old /auth path, a missing or wrong verify-auth redirect URI, and group or audience mappers that do not match what Rancher expects. Users can also log in but see no groups because query-groups or query-users roles were never assigned. Verify each endpoint with the Specify option, test a login from each mapped group, and check that the search function works for a non-admin user. Keep a local administrator path in Rancher so you can recover if the SSO configuration blocks logins.
Who maintains the configuration after go-live?
After go-live, your team owns the Keycloak realm, the Rancher authentication settings and the group mappings, and it must plan upgrades for both products. Keycloak ships four minor releases a year and a major release every two to three years, and Kubernetes ships about three minor releases a year with patch support for each. Each upgrade can change client behavior or endpoints, so retest the Rancher login path after every change. Ongoing support, upgrades and continuous testing are available from DeployOpen as retainers, which you can compare with keeping the work in-house.
How DeployOpen scopes and delivers Rancher SSO work
DeployOpen scopes Rancher SSO work as a fixed-scope engagement agreed in writing before any work starts. DeployOpen is a Chainscore Labs company that plans, implements, hardens, documents and supports self-hosted open-source platforms inside the client's own infrastructure, including their cloud accounts, data centers or air-gapped networks. For this topic, the written scope would normally name the Keycloak realm and client, the choice between OIDC and SAML, the verify-auth redirect URI for the Rancher host, the groups, audience and full group path mappers, the query-users, query-groups and view-users roles, the endpoint settings for Keycloak 17 and later, and the Rancher and Keycloak environments where the work lands. A quote follows from that written scope, so the more precisely the scope names these items, the more precisely the quote can be read.
Delivery and ongoing support are priced and documented separately. The initial engagement covers the build, the verification of sign-in and group mapping, and the handover documentation your team needs to run the setup. Ongoing support, Rancher or Keycloak upgrades and continuous testing are available as retainers, which suit teams that expect to change group structures or endpoints over time. Ask whether a retainer covers upgrades of both Rancher and Keycloak, since each has its own release line and breaking-change notes to review. DeployOpen prepares the configuration, controls and evidence that your compliance and security reviewers examine, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies perform those assessments, and your review of this integration should be scheduled with them accordingly.

