Open-source SSO for Kubernetes compared

Dex, Keycloak and authentik compared for single sign-on to the Kubernetes API server, so you can match the tool to your upstream providers, user storage and in-cluster operating effort.

On this page

Open-source SSO for Kubernetes compared: which option fits which cluster

A platform team that needs kubectl users signed in through corporate identity should choose Dex when the cluster is the only consumer and the corporate directory already holds the users, because Dex is a connector broker with no user store of its own. It is configured through a single YAML file, runs natively on Kubernetes with Custom Resource Definitions, and hands authentication to LDAP, GitHub, Google or Active Directory. Choose Keycloak when the same identity server must also serve applications, brokered logins and user federation beyond the cluster, since it is a full identity server with its own production database and a Kubernetes Operator. Choose authentik when you want a broader provider with a server container and a worker container backed by PostgreSQL, and you can accept that some features, such as Google Workspace and Microsoft Entra ID integrations, sit in the paid enterprise edition.

Dex has a condition attached to it that matters for kubectl. Its SAML 2.0 connector is marked unmaintained and likely vulnerable to authentication bypasses, and no refresh token is issued through SAML because assertions cannot be refreshed non-interactively. Since kubectl needs refresh tokens for offline access, confirm which connector your directory will use and test that a login through it returns a refresh token before you commit. Keycloak and authentik both need a relational database in production, so the operating effort is a database, backups and upgrade planning. Keycloak's operator manual approval mode is worth adopting, and its database schema migrates at startup by default, which you may want to switch to manual for large deployments.

Before you pick, confirm three things in a test cluster: that the API server accepts OIDC flags pointing to your chosen provider, that your upstream connector returns the group claims you need for RBAC, and who will patch the identity tier when a security release arrives. Ask any vendor or implementation partner to state in writing which components they will install inside the cluster, which they will leave in your existing directory, and how refresh tokens behave for your user population.

Which Kubernetes SSO option fits your situation

This table maps common Kubernetes SSO situations to the option that fits best, with the reason tied to supplied facts about Dex, Keycloak and authentik. Read each row against your upstream identity source, number of downstream apps and team capacity, then confirm the open points with the vendor or in your own environment.

ScenarioBest fitReason
One upstream OIDC provider for kubectl and cluster toolsDexDex is built for Kubernetes, is configured through a single YAML file, and acts as a portal to an upstream OIDC provider so the API server can use OpenID Connect.
Active Directory or LDAP users who need kubectl accessDex or KeycloakDex has a stable LDAP connector, but Keycloak federates users from LDAP or Active Directory directly and also brokers OIDC and SAML logins. Confirm that refresh tokens work for your login path before choosing.
Many apps beyond the cluster sharing one loginKeycloak or authentikKeycloak provides SSO, identity brokering, user federation and an admin console across OIDC, OAuth 2.0 and SAML 2.0. authentik offers OAuth2/OIDC, SAML, LDAP, proxy and other provider types, but some enterprise integrations sit in its paid edition.
Small team with no in-house identity staffDex with an existing upstream providerDex owns no user state and delegates authentication, so there is less to operate. Keycloak in production needs a relational database and a synchronously replicated database for its high availability designs.
Regulated environment that needs paid vendor supportKeycloak (Red Hat build) or authentik EnterpriseRed Hat build of Keycloak is Red Hat's supported distribution of Keycloak. authentik lists Enterprise and Enterprise Plus editions with ticket-based support. Confirm support scope, SLAs and certification status directly with each vendor.
Need for user storage inside the identity platformKeycloak or authentikDex owns no user state and has no user store of its own. Keycloak and authentik both store users and configuration in a database, so plan backups and upgrades for that data.
Need for refresh tokens so kubectl sessions persistDex with a non-SAML upstreamDex issues no refresh token for logins through its SAML connector because SAML has no non-interactive way to refresh assertions. Use an OIDC, LDAP or GitHub connector where offline access matters.

How OIDC login reaches the Kubernetes API server

A kubectl login starts with a client-side tool such as kubelogin, which opens a browser, sends the user to the identity provider, and receives tokens back. The API server never sees the password or the browser session. It only checks the ID token presented in each request, using the OIDC settings in its own startup configuration: --oidc-issuer-url, --oidc-client-id, and the claim mappings for the username and groups. The issuer URL must match the iss value in the token exactly, and the API server must be able to reach that issuer's discovery document and signing keys over the network. Whether Dex, Keycloak or authentik sits behind the issuer, the same checks apply, so confirm the issuer, client ID, and claim names in your own cluster before you blame the identity provider for a failed login.

Refresh tokens matter because ID tokens are short-lived. A kubectl session that needs to keep working past the token lifetime, or a script that must run without someone present, depends on the client receiving a refresh token and exchanging it for new ID tokens. Dex's README states that it issues no refresh token when a user logs in through its SAML connector, because SAML has no non-interactive way to refresh assertions. The practical result is that a team using SAML upstream may find that users must log in again whenever their token expires. Test the exact connector and client combination you plan to use, and confirm the token lifetimes and offline access settings in your environment, since this behavior depends on the connector and client configuration rather than on the cluster alone.

Before you commit to a design, run a test login through each candidate and check three things: that the API server accepts the ID token, that the refresh token is issued and renewed, and that group claims arrive in the form your RBAC bindings expect. Keep the issuer's TLS certificate chain available to the API server, because a trust failure there looks like a generic authentication error. Record the results against the connector you intend to use in production, not against a demo login with a local account, so that the verdict reflects the path your users will actually take.

Dex, Keycloak and authentik in brief, with licenses

Dex, Keycloak and authentik each sign users in to a Kubernetes cluster through OpenID Connect, but they differ sharply in scope. Dex is a thin federation layer, Keycloak is a full identity server, and authentik sits between them with a split license. Check the license, the storage requirements and the upgrade cadence of each before you commit to one.

Dex, a federation broker for Kubernetes

Dex is licensed under the Apache License 2.0, and v2.46.0 was released on October 7, 2026. It is a CNCF Sandbox project built for Kubernetes and configured through a single YAML file. Dex owns no user accounts and delegates login to upstream providers through connectors, so the cluster's sign-in path depends on those connectors remaining healthy. Check which connector you need before you rely on it, because the README marks LDAP, GitHub and SAML 2.0 as stable and warns that the SAML 2.0 connector is unmaintained. Dex issues no refresh token through SAML, which matters for kubectl users who need offline access.

Keycloak, a full identity server

Keycloak is licensed under Apache-2.0, and release 26.8.1 was published on October 13, 2026. It is a CNCF incubating project that provides OpenID Connect, OAuth 2.0 and SAML 2.0, brokers logins to external providers and federates users from LDAP or Active Directory. Because it stores users and needs a supported relational database in production, it carries more operating work than Dex. Plan for database sizing, high availability with a synchronously replicated database, and a Keycloak Operator upgrade process with manual approval mode.

authentik, a split license

authentik's core is MIT licensed, released as version 2026.8.4 on October 14, 2026. Code under the authentik/enterprise directory uses a separate enterprise license and needs a paid subscription for production use. That code is not OSI open source, so a deployment that relies on it inherits those terms. Check which features you need, such as Microsoft Entra ID or Google Workspace integration, before choosing authentik for Kubernetes login. Its architecture also requires PostgreSQL, which holds all configuration and data except uploaded files.

How to choose and pilot an SSO option for your cluster

This sequence turns a shortlist of Dex, Keycloak and authentik into a tested choice, so the team knows which upstream sources, token behavior and operating model fit its cluster before wider rollout.

  1. Inventory your upstream identity sources

    List every place your users already have accounts, such as an LDAP directory, Active Directory, a SAML identity provider, or hosted providers like GitHub or Google. Dex relies on connectors to reach these sources, and its README marks LDAP, GitHub and SAML 2.0 as stable while several other connectors are beta or alpha. Keycloak can broker external OpenID Connect or SAML providers and federate LDAP or Active Directory users, and authentik offers LDAP and OIDC sources. Done means you have a written list of each source, its protocol, and the connector maturity you need. Confirm connector status against the current release before you rely on it.

  2. Confirm whether kubectl needs refresh tokens

    Decide whether users must stay logged in without re-authenticating through a browser. Dex's README notes that it issues no refresh token when a user logs in through the SAML connector, because SAML has no non-interactive way to refresh assertions, and clients that need offline access, such as kubectl, depend on refresh tokens. If your users reach the cluster through SAML-backed login, treat this as a blocker to test early. Done means you have tested a login through each upstream source and recorded whether a refresh token was issued and honored by your kubelogin or kubectl setup.

  3. Choose the user store model

    Decide where user and client state will live. Dex owns no user state and delegates authentication to existing providers, but it still stores its own state in etcd, Kubernetes CRDs, PostgreSQL or MySQL. The Dex documentation says CRDs may not suit a large number of users, and SQLite3 is only for standing Dex up quickly. Keycloak requires a relational database in production (PostgreSQL 14 to 18, MariaDB, MySQL, SQL Server, Oracle or Aurora PostgreSQL). authentik stores all configuration and data in PostgreSQL. Done means you have chosen a storage backend, confirmed it is supported for production in your environment, and written down the database your team will back up and restore.

  4. Decide who runs the in-cluster component

    Assign ownership for installing, upgrading and troubleshooting the SSO component inside the cluster. Dex runs natively on Kubernetes through CRDs and is configured from a single YAML file. The Keycloak Operator is installed through Operator Lifecycle Manager, which Keycloak recommends, or with kubectl, and the Keycloak Operator documentation strongly recommends manual approval mode for updates. authentik runs as a server container with an embedded outpost plus a worker container. Name the platform or security owner, the on-call route for login failures, and the upgrade approval process. Done means a named owner signs off on the operating model and the team can state who applies each upgrade.

  5. Set up the Kubernetes API server and test one login path

    Configure the API server to trust the chosen OIDC issuer, then log in with kubelogin or kubectl using a single test account. Dex is designed to drive API server authentication through the Kubernetes OpenID Connect plugin. Verify that the token carries the group or claim values your RoleBindings expect, and that a user outside the intended group is refused. Done means one successful login, one correctly denied login, and a record of the exact issuer, client and claim settings used, kept under version control.

  6. Run a pilot with one cluster and a test group

    Limit the pilot to one non-production cluster and a small test group drawn from the teams that will use it. Include at least one user from each upstream source on your list, one user who needs long-lived kubectl sessions, and one administrator who will perform upgrades. Track failed logins, token expiry behavior, and how long a rotated signing key or client secret takes to propagate. Keycloak's high availability designs require a synchronously replicated database, and authentik's Docker Compose guide targets small-scale production, so note whether your pilot topology matches the production design you intend. Done means the test group completes its normal tasks and the open issues are logged with owners.

  7. Roll out in stages and keep the evidence

    Expand from the pilot to more clusters in stages, adding user groups only after the previous stage closes its issues. Before each stage, confirm the upstream source list, the refresh token behavior and the upgrade approval process still match what was tested. Keep the configuration, upgrade records and login test results as evidence for your internal reviews and any compliance assessment you prepare for. Done means every cluster in scope has a documented configuration, a named owner and a tested login path, and the rollout plan states what changes trigger a re-test. Ask the vendor or implementation partner for a written scope and deliverables before work starts.

What running Keycloak or authentik inside the cluster costs in effort

The effort of running Keycloak in a cluster starts with its database. Keycloak needs a relational database in production, and its default dev-file database is not suitable for production. Plan for the database as a separate component with its own backup, patching and failover, and confirm which of the supported engines your platform team already runs. The Keycloak Operator is installed through the Operator Lifecycle Manager, which Keycloak recommends, or with kubectl. Because the operator manages Keycloak, KeycloakRealmImport, KeycloakOIDCClient and KeycloakSAMLClient resources, you should set manual approval mode for operator updates so that upgrades happen when your team chooses. Keycloak also migrates its database schema automatically at startup by default. Test that migration against a copy of production data, and consider the manual migration path the upgrading guide suggests for large deployments. If you need high availability, both supported designs require a synchronously replicated database, which is often the largest single cost driver in the design.

authentik has a smaller component list but a different dependency profile. A deployment runs a server container with core and an embedded outpost, a worker container for background tasks, and PostgreSQL, which holds all configuration and data except uploaded files. Since the 2025.10 release, authentik no longer uses Redis, and caching, tasks, sessions and WebSocket functions run on PostgreSQL instead. The 2025.10 release notes warn of roughly 50% more PostgreSQL connections after upgrading, so check your connection limits and any pooler before you move a cluster from an older release that still depends on Redis. Confirm with your platform team whether they already operate PostgreSQL with the capacity to absorb this load. Also check the enterprise boundary early, because Google Workspace, Microsoft Entra ID and enhanced audit logging sit behind the paid edition.

Dex is the lightest option on this list, and its storage choice determines most of its operating work. Dex can store state in etcd v3, Kubernetes CRDs, PostgreSQL or MySQL 5.7 or later. The Dex documentation says CRDs may not suit a large number of users, so teams with many users should not default to them. SQLite3 is only for standing Dex up quickly, not for real workloads, so treat it as a trial setting and plan a migration to etcd, CRDs or a database before any shared use. Because Dex owns no user state, your effort is mostly in connector configuration and in keeping the upstream identity provider reachable, not in running a user store. Confirm with your identity team which upstream connector you will use, since the README marks the SAML 2.0 connector as unmaintained and warns of likely auth bypasses.

Questions buyers ask before choosing Kubernetes SSO

Which Kubernetes SSO option needs the least effort inside the cluster?

Dex usually needs the least in-cluster effort because it is built for Kubernetes, runs natively on Custom Resource Definitions and is configured through a single YAML file. It owns no user store and defers authentication to an upstream provider, so the work centers on connectors and client configuration. Keycloak and authentik carry more: Keycloak needs a relational database in production and the Keycloak Operator adds lifecycle work, while authentik runs a server container, a worker container and PostgreSQL. Ask any implementer to list the database, the upgrade path and who patches each component, since those drive the ongoing effort more than the first install.

Can Dex federate Active Directory for kubectl logins?

Dex can connect to Active Directory through its connectors, which include LDAP and Microsoft options. The README marks the LDAP and GitHub connectors as stable, while the Microsoft connector is listed as beta, so confirm the connector status against your Dex version before you commit. Dex also warns that the SAML 2.0 connector is unmaintained and likely vulnerable to authentication bypasses, so avoid it for Active Directory logins. If your directory must be the system of record for groups and accounts, test group mapping end to end with a real kubectl login before you rely on it.

What do refresh tokens mean for kubectl sessions?

Refresh tokens let kubectl obtain new access tokens without prompting the user again, which matters for long-running sessions and offline access. Dex issues no refresh token when a user logs in through the SAML connector, because SAML has no non-interactive way to refresh assertions. If your engineers use kubectl through a SAML-backed upstream, expect to re-authenticate often, or choose an OIDC or LDAP path that issues refresh tokens. Confirm the token lifetimes and rotation policy with your security team and write them into the implementation scope.

What licensing limits apply to authentik?

authentik core is MIT licensed, but code under the authentik/enterprise directory is under the authentik Enterprise Edition license and needs a paid subscription for production use. The pricing page lists Enterprise features including Google Workspace and Microsoft Entra ID integrations, mTLS client certificate authentication, privileged access management, password history and enhanced audit logging. If your Kubernetes SSO depends on any of these, budget a subscription and ask the vendor to confirm which features apply to your edition. Keycloak and Dex are Apache-2.0 licensed, so a licensing review for those is typically simpler.

What drives the cost of a fixed-scope Kubernetes SSO implementation?

A fixed-scope engagement is priced from the written scope, so the main drivers are the number of upstream identity providers, the number of clusters and tools that need SSO, the group mapping rules and the hardening you require. Costs recur when you need upgrades, retainers for ongoing support, or subscriptions for paid editions such as authentik Enterprise. Ask for a quote that separates one-time work (design, deployment, integration, documentation, handover) from recurring items (support, upgrades, licenses), and that lists the assumptions about the existing directory and network. DeployOpen does not publish a price list, so the written scope is the basis for any figure.

Can our platform team set up Kubernetes SSO without outside help?

A capable platform team can deploy Dex with an existing upstream provider, since its configuration is a single YAML file and the Kubernetes OpenID Connect plugin is the documented integration point. The harder parts are usually the upstream connector configuration, group claims, refresh token behavior and the operating model for upgrades and key rotation. Keycloak or authentik deployments add a database, high availability design and a patch cadence, which can take more time than the first login works. Decide which work your team will own, then ask a provider to scope only the gaps, with deliverables and handover agreed in writing before work starts.

What it costs to switch SSO options after go-live

Switching the SSO option behind a running cluster is mostly a change to the trust relationship between the Kubernetes API server and its identity issuer. Every cluster that authenticates users through OIDC carries the issuer URL and client ID in its API server flags or structured authentication configuration, so moving from Dex to Keycloak or authentik means changing that setting on every control plane, rolling the API server restarts in a planned window, and confirming that group and username claims still map to the same RBAC bindings. Each cluster is a separate change, so the count of clusters, not the count of users, usually drives the effort. Ask your platform team to list every cluster, its API server configuration source, and every RBAC binding that depends on a claim name before you commit to a switch.

The second cost is on the user side. Kubeconfig files, kubelogin settings and any scripts that hold the issuer URL or client secret must be reissued or updated, and users with cached refresh tokens will need to log in again. Dex's storage determines what can move cleanly: Dex stores its state in etcd, Kubernetes CRDs, SQLite3, PostgreSQL or MySQL, and its own documentation warns that CRD storage may not suit a large number of users. Dex also owns no user store, so its user records live in the upstream connector. Moving to Keycloak or authentik therefore means recreating users, groups and client registrations in the new issuer, or federating them from the same LDAP or Active Directory source, and testing that the claims the cluster expects still arrive. Treat that migration as a project with its own test plan, not a configuration edit. (Illustrative: a team with a small number of clusters and a single LDAP source will face a far smaller change than one with many clusters and per-team connectors.)

Plan the exit before go-live by keeping the issuer, client ID and claim mapping in version-controlled configuration, and by documenting which upstream connector each user comes from. Keep a tested fallback path, such as a break-glass certificate or service account, so an issuer outage or a failed switch does not lock administrators out of the API server. Ask any implementation partner for the written scope to cover cluster-by-cluster cutover steps, rollback criteria and the post-switch verification of RBAC, and confirm how refresh token behavior changes between the old and new issuer, since Dex issues no refresh token for SAML logins and kubectl depends on refresh tokens for offline access.

How DeployOpen scopes Kubernetes SSO selection and rollout

DeployOpen plans, implements, integrates, hardens, documents and supports self-hosted open-source platforms inside the client's own infrastructure. For Kubernetes SSO, that means choosing between Dex, Keycloak and authentik against your identity sources, cluster setup and operating capacity, then building the rollout in your environment.

How we scope

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • We map your upstream identity providers, required connectors and whether users need refresh tokens for kubectl.
  • The written scope names the clusters, API server settings, user groups and audit evidence that are in and out of the work.

How we build

  • We install and configure the chosen SSO component in your cluster, using the deployment method your platform team already runs.
  • We wire OpenID Connect settings into the Kubernetes API server and test kubelogin and kubectl flows for each user group.
  • We test token expiry, refresh behavior and failure paths, and document the configuration and its known limits.

How we hand over

  • You receive configuration, runbooks and upgrade notes written for the team that will operate the system after handover.
  • We walk your platform and security staff through login troubleshooting, certificate rotation and backup of the SSO data store.
  • We record which decisions were made, which open questions remain, and what to confirm with each vendor before production.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, scoped separately from the initial project.
  • Retainers can cover version upgrades of the SSO component, which your team should plan around vendor release and patch policies.
  • Quotes follow from the written scope, so ask for line items covering design, build, testing, handover and any recurring support.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.