Keycloak on Kubernetes with the Keycloak Operator

A practical guide to running Keycloak on Kubernetes with the official operator, covering install methods, the Keycloak and realm import custom resources, clients as code, database connectivity and manual update approval.

On this page

How the Keycloak Operator runs Keycloak on Kubernetes

The Keycloak Operator manages the Keycloak server itself as a Kubernetes resource, including its deployment and the custom resources that describe realms and clients. Your platform team still owns the database, the TLS certificates and hostnames, the secrets that hold credentials, the cluster capacity Keycloak runs on, and every decision about when a new Keycloak version reaches production. The operator turns those declarations into running workloads, but it does not make those upstream decisions for you. Teams usually adopt the operator when a single container is no longer enough. The typical triggers are several environments that must match each other, a GitOps workflow where cluster state lives in version control, and multiple realms that need to be created the same way in each environment. The Keycloak custom resource covers the server, the KeycloakRealmImport resource loads realm definitions, and the KeycloakOIDCClient and KeycloakSAMLClient resources let you manage clients as code. Confirm with the current operator documentation which resource fields your Keycloak version supports before you write manifests. The hard parts are less about starting Keycloak and more about keeping it stable over time. Keycloak needs an external production database, so you must decide how the database is provisioned, backed up and reached from the cluster, and confirm that the version you choose is on the supported list. Update control is the second issue: the operator documentation strongly recommends manual approval mode so that an operator upgrade does not trigger an unplanned Keycloak upgrade. Set this approval policy deliberately before go-live and record who approves each change. Secrets are the third issue. Database credentials, admin credentials and client secrets must come from a secret store or a sealed mechanism that your GitOps tooling can read without exposing plaintext in the repository. Confirm how your chosen tooling interacts with the operator's secret references before you commit to a pattern. The fourth issue is drift. A realm or client declared in a custom resource can be changed in the admin console, and those changes may be overwritten on the next reconciliation or may leave the cluster and the declared state out of step. Decide which side is authoritative for each realm, restrict console edits in production, and run a check that compares live configuration with the declared resources before each release.

Which Keycloak Operator resources and settings you will manage

The Keycloak Operator splits a deployment into a few custom resources, each owning a different part of the identity setup. Knowing which resource owns which setting tells your team where changes belong, where they will be overwritten, and where secrets and configuration maps sit in the cluster.

The Keycloak custom resource

The Keycloak resource defines the server deployment itself: instance count, container image, hostname, TLS configuration, and database connection details. Sensitive values such as the database password and TLS material are referenced from Kubernetes Secrets rather than typed into the resource. Check the field names and the Secret keys against the operator version you install, because they change between releases.

The KeycloakRealmImport resource

KeycloakRealmImport loads a realm definition, including its clients, roles and users, into a running Keycloak instance. It is an import step, not continuous synchronization, so later changes made in the admin console or through the API are not reconciled back from the resource. Confirm how the operator handles re-imports of an existing realm and where realm JSON files are stored, typically in a Secret or ConfigMap, before you rely on it for environment promotion.

The KeycloakOIDCClient resource

KeycloakOIDCClient declares an OpenID Connect client, including its redirect URIs, client type and scopes, as a Kubernetes object managed in version control. Client secrets are normally generated or referenced through a Secret, so the secret value stays out of the manifest. Confirm which client attributes the version you run can set declaratively and which must still be changed in the admin console.

The KeycloakSAMLClient resource

KeycloakSAMLClient declares a SAML 2.0 service provider, including its entity identifier, assertion consumer endpoints and signing settings. Signing certificates and keys are the items to handle carefully, so confirm whether the operator reads them from a Secret and how rotation is performed. SAML attribute and name ID mapping may need to be verified in the realm after the resource is applied.

The Keycloak Operator itself

The operator is the controller that reconciles the custom resources into running workloads, and it is installed through Operator Lifecycle Manager, kubectl, or an experimental Helm chart. Its own upgrades change how every resource behaves, so the operator documentation strongly recommends manual approval mode for updates. Plan who approves an operator upgrade and test it against a non-production cluster first.

Configuration maps and secret ownership

Non-sensitive server options can sit in ConfigMaps, while passwords, keys and certificates belong in Secrets with restricted role-based access. Decide early which team can read and rotate each Secret, because the operator reads these references at reconciliation time. Confirm the exact key names and which settings are read only at startup, using the documentation for your installed version.

Which install method and update model fit your platform

This table compares the three ways to install the Keycloak Operator and the two update models, manual or automatic operator updates and schema migration. Read each row against your team's approval process and how much drift you can tolerate, since the operational cost of each choice lands on the same people. The main takeaway is that OLM with manual approval fits most regulated environments, while the experimental Helm chart needs a stronger case before production use.

OptionWhen it fitsOperational costWho approves and maintains
OLM (Operator Lifecycle Manager)Clusters where OLM is already running and the platform team wants subscription-based operator lifecycle management, which is the recommended methodOLM tracks the operator version and can apply updates; the team still reviews each upgrade and watches for drift in custom resourcesPlatform team manages the subscription; set approval mode to manual so upgrades wait for sign-off
kubectl installTeams that manage manifests in Git and want every operator change to pass through a pull request and a pipelineYou maintain the operator manifests yourself, track each new release by hand, and reapply them during upgradesPlatform or GitOps owners approve each manifest change; drift is caught only if the pipeline compares live state to Git
Experimental Helm chartTeams already standardized on Helm for cluster add-ons and willing to accept an experimental install path for non-critical environmentsThe chart is marked experimental, so expect more manual checks of values, CRD versions and upgrade behavior before each changePlatform team owns chart versions and values; confirm current status and support scope with the Keycloak project before production use
Manual operator updatesRegulated environments where every change to the running operator needs a documented approval and a test run firstHighest effort per release, since someone must read release notes, test realms and schedule the window, but no change lands unannouncedChange board or platform lead approves each version; the Keycloak Operator documentation strongly recommends this mode
Automatic operator updatesNon-production or lab clusters where fast patching matters more than controlled change timingLower routine effort, but an upgrade can reach a production-like cluster before realm and client tests have runTeam accepts upgrades without a per-release gate, so test coverage and rollback planning must carry the approval step
Automatic schema migration at startupSmaller or lower-risk databases where a short upgrade window is acceptable and the default behavior is adequateMigration runs when the new Keycloak pod starts, so a failed migration appears during the rollout rather than before itOperations team must confirm backups and a rollback path exist before the rollout starts
Manual schema migrationLarge databases or deployments where the DBA must review and apply SQL before pods are rolledMore steps and a separate DBA task per release, but the schema change is reviewed and timed deliberatelyDBA and platform team approve the SQL; the upgrading guide suggests this approach for large deployments

Installing the Keycloak Operator in a cluster, step by step

This sequence takes an empty Kubernetes cluster to a running Keycloak instance with TLS, a production database, an imported realm and a client managed as code. Each step ends with a check so the platform team knows it can move on.

  1. Prepare the namespace and secrets

    Create a dedicated namespace for the identity platform and restrict who can read it using your cluster's role-based access controls. Create the database credentials, the bootstrap admin credentials and the TLS certificate material as Kubernetes secrets, sourced from your secrets manager where your policy requires it. Confirm the secrets exist and that only the intended service accounts can read them. The check is a listing of the secret names in the namespace with no values printed in your logs or terminal history.

  2. Install the operator with the chosen method

    Install the Keycloak Operator using the method your platform team selected. Operator Lifecycle Manager is the method the project recommends, and kubectl and an experimental Helm chart are the alternatives. Confirm the install method against the current Keycloak Operator installation documentation before you start, because the steps differ by method. The check is that the operator deployment reports ready and its pod is running in the target namespace, with its custom resource definitions registered in the cluster.

  3. Set operator update approval to manual

    If you installed through Operator Lifecycle Manager, set the subscription's update approval to manual so that a new operator version cannot upgrade Keycloak without a person reviewing it. The Keycloak Operator documentation strongly recommends this mode to avoid unintended automatic upgrades. Record who approves updates and where the review happens. The check is the subscription showing manual approval and the install plan waiting for sign-off rather than applying itself.

  4. Deploy the Keycloak resource with TLS and a production database

    Create the Keycloak custom resource and point it at a supported production database, not the development file database. Reference the database secret, enable TLS for the server with your certificate, and set the public hostname so that issued tokens and redirects use the correct address. Keep the admin console and the Administration REST API on a separate hostname or path, as the production guide advises. Confirm the database engine and version against the Keycloak database guide before you apply the resource. The check is the Keycloak resource reporting a ready status with the pods passing their readiness probes.

  5. Confirm startup and schema migration

    Watch the first Keycloak pod start and confirm that the database schema migration completed. By default Keycloak migrates the schema automatically at startup. For large or tightly controlled environments, your database team may prefer to apply the SQL manually, as the upgrading guide describes, and that choice should be made before this step. Check the pod logs for a completed startup and confirm the health endpoint responds. The check is a successful readiness response from the health endpoint and no migration errors in the logs.

  6. Import a realm

    Create a KeycloakRealmImport custom resource that references a realm definition, so the realm is built from reviewed configuration instead of by hand in the admin console. Store the realm file in version control and keep secrets for client credentials out of it. Confirm that the import job completed and that the realm appears in the admin console with the expected settings. The check is the import resource reporting success and the realm's users, roles and default settings matching the reviewed file.

  7. Create a client as a resource

    Define the application client as a KeycloakOIDCClient custom resource, with redirect URIs, client type and the secret reference, then apply it to the cluster. Managing clients as resources means changes go through the same review as the rest of your infrastructure. Test the sign-in end to end with a test user and confirm the token contains the claims your application expects. The check is the client resource reporting ready and a successful sign-in test that returns a token to the application's test redirect URI.

How Keycloak database connectivity and schema migration work on Kubernetes

The database is the one part of a Keycloak deployment that holds state you cannot rebuild, so the first decision is choosing a supported engine. Keycloak's database guide lists MariaDB, Microsoft SQL Server, MySQL, Oracle Database, PostgreSQL 14 to 18, EnterpriseDB Advanced, Amazon Aurora PostgreSQL and Azure SQL as supported production databases. Confirm the exact version your platform team plans to run against that guide before you commit, because the supported range is the baseline you test against. The default dev-file database stores data on the local filesystem of a single instance. It suits local experiments only. It cannot be shared across replicas, it cannot support the high availability designs Keycloak documents, and it ties users, clients and configuration to one pod's disk.

With the Keycloak Operator, the database connection is declared in the Keycloak custom resource, and the operator turns that declaration into server configuration. Confirm the field names and the vendor value for your engine in the operator reference, since they can change between releases. Credentials belong in Kubernetes Secrets that the custom resource references by name, with one Secret for the database user and one for the password. Keep those manifests out of Git, manage the Secrets through your existing secret tooling, and restrict who can read them with RBAC. Rotating a database password then means updating the Secret and restarting the pods, which your change process should rehearse before the first rotation is due.

Keycloak migrates its database schema automatically at startup by default. For a small or non-production instance, this is the simplest path: a new pod applies pending changes before it serves traffic. For a large deployment, the upgrading guide suggests manual migration instead. Administrators generate the SQL for the target version, review it with the database team, and apply it on a schedule outside the rollout. This separates the schema change from the pod restart, lets a DBA check locking and run time against production data volumes, and gives you a script to work from if you need to roll back. The cost is process. Someone must own the SQL, and the operator update and the schema change must be sequenced so the running version always matches the schema it expects.

Before the first production start, check three things against the Keycloak database guide. First, the network policy must allow traffic from the Keycloak pods to the database port, and nothing else should reach it. Second, certificate trust must be in place so Keycloak verifies the database certificate against a CA bundle you mount into the pods. Third, the database version must fall within the supported range. Test all three in a staging namespace that uses the same network policies as production. If you plan a high availability design, confirm that the database is synchronously replicated, because the high availability documentation requires this for the supported designs. Record the test results in the change record so that auditors and operators can see the connection was verified before go-live.

What drives Keycloak Operator effort and cost

This table lists the factors that change how much work a Keycloak Operator deployment takes to build and run, with the effect of each and the practice that keeps it contained. Read each row against your own realm, client and environment counts to see which drivers apply most to your rollout. The main takeaway is that declarative resources and one shared operator pattern usually matter more to long-term effort than the initial install.

DriverHow it raises effortHow to keep it down
Realms and clients as resourcesEach realm and each KeycloakOIDCClient or KeycloakSAMLClient resource needs its own definition, review and change path, so effort grows with the count and with how often clients change.Template client definitions from a shared base, group clients by realm in the repository, and limit realms to real tenant or trust boundaries.
Existing GitOps toolingIf the team already runs a GitOps controller, the operator resources must fit its sync, review and secret handling. Building that integration from scratch adds design and testing work.Reuse the existing pipeline and repository layout, and keep Keycloak resources in the same review flow as other cluster objects.
Database provisioningThe operator connects to an external database, so the database, credentials, backups and network rules must exist before go-live. Ownership split between the platform and database teams often causes delays.Agree the database owner, secret delivery method and backup policy in the scope document before installation starts.
High availability designMulti-node clusters, a synchronously replicated database and session behavior under failover need more configuration and more failover testing than a single instance.Choose one supported HA architecture early, keep node counts and caches uniform across environments, and script failover tests so they repeat.
Number of environmentsEach environment carries its own realms, secrets, database and upgrade test, so effort multiplies with every added stage.Promote the same resource definitions through environments with only values changed, and keep non-production topology close to production.
Directory and identity provider integrationsLDAP, Active Directory, brokered providers and mappers each need configuration, attribute mapping and test accounts, and each adds a dependency that can fail during an upgrade.Limit integrations to those with a confirmed business need, document mapper rules, and test each provider in the lower environment before production.
Custom extensionsCustom themes, authentication flows and provider code must be rebuilt and retested for each Keycloak minor release, which raises the recurring cost of ownership.Prefer configuration over code, keep themes minimal, and record which extensions exist so upgrade testing covers them.
Operator update approvalAutomatic operator updates can change behavior without a planned test window, so the team must handle unplanned rework when they occur.Keep manual approval mode for operator updates, schedule upgrades with release notes reviewed, and test realms before approving.
Compliance evidence needsAssessors may ask for change records, access reviews, backup restore results and logging configuration. Each one must be produced and kept, which adds recurring work.Define the evidence list early, export it from the GitOps history and monitoring stack, and confirm with your assessor which artifacts they expect.

Managing Keycloak clients as Kubernetes resources

Declare each OIDC or SAML client as a KeycloakOIDCClient or KeycloakSAMLClient resource and keep those manifests in the same Git repository and review process as the application that uses them. The point of this approach is that a client's redirect URIs, protocol settings and scopes change through a pull request that someone other than the author approves, and the cluster state can be traced back to a commit. The operator reconciles the Keycloak realm to match the manifest, so the manifest, not the admin console, becomes the record of what the client should look like. Client secrets should never appear in these manifests. Reference a Kubernetes Secret from the client resource and populate that Secret through your normal secret management path, such as an external secrets controller, sealed secrets or a vault integration. Confirm in your operator version's documentation exactly which secret reference fields are supported and which key names the operator expects, because the field names have changed between releases. Check also whether the operator reads the secret value into Keycloak on every reconcile, since that determines how a rotation propagates.

Drift happens when someone edits a client in the admin console during an incident or a quick fix. Decide before go-live whether the operator should revert such changes on its next reconcile or whether you accept a manual override and then fold it back into Git. Either way, run a periodic comparison between the live realm export and the manifests so unexpected edits are visible. Restrict admin console write access to a small group, and record administrative events so the change can be traced to a person and a time. Client review belongs to the team that owns the application, with the identity team as a required second reviewer for anything that changes redirect URIs, scopes, token lifetimes or authentication flows. Tie client changes to application releases: a new redirect URI should land in the same release that deploys the page that uses it, and a rollback of the application should carry its client configuration with it. Agree on this ownership model in writing before the first client is migrated.

Not every client setting necessarily maps one-to-one to a field in the custom resource. Some attributes, advanced protocol mappers or newer features may be absent from the resource schema, or may only be set through the admin console or the Administration REST API. Before you commit to a GitOps model, compare the settings your clients use against the schema of the operator version you have installed, and list any gaps. For each gap, decide whether to accept a documented workaround, extend the configuration through a realm import, or keep the setting out of scope for the operator. Record the operator version alongside the client manifests and re-run this comparison before each operator update, because field coverage can change between releases. Ask the operator's maintainers or your Red Hat support contact, if you use the Red Hat build, which fields are supported in the version you run. Test one representative client end to end in a non-production realm before relying on the resource for production.

How deployment model changes the Keycloak Operator build

A single Keycloak cluster in one Kubernetes environment is the most direct high availability design. All Keycloak pods share one database and form one cluster, so the Keycloak custom resource describes one deployment that scales across pods. Spreading that cluster across availability zones is optional. It changes where pods and database nodes run, but the operator resource model stays the same.

For an availability zone layout, the build typically needs:

  • A synchronously replicated database across the zones the nodes use, because both supported high availability designs require it.
  • Pod placement rules such as topology spread or anti-affinity, so replicas do not all land in one zone. Confirm the field names for your operator version.
  • A load balancer in front of the Keycloak service that health checks each pod.
  • Latency checks between zones, since session replication and database commits both depend on it.
  • Database credentials kept in one secret that the Keycloak resource references.

Before go-live, ask your platform team how a single zone failure will be simulated and what result is expected.

How to operate and upgrade the deployment after go-live

The operating model for a Keycloak Operator deployment is set by three things: what you watch, what you back up, and how a change moves from review to production. Keycloak exposes Prometheus-format metrics at /metrics on its management interface, but only when it is started with --metrics-enabled=true. Confirm that the Keycloak custom resource sets this flag, that the management port is reachable only from your monitoring namespace, and that the scrape target is listed in your Prometheus configuration. Health endpoints on the same management interface serve liveness and readiness probes, so the kubelet can restart or drain pods without operator intervention. Your on-call team should know which signals page them, such as failed logins, latency and cache health, and which only open a ticket.

Backups need to cover three separate things. The database holds users, clients, sessions and configuration, so it needs point-in-time recovery and a restore test, not just a nightly dump. Realm exports, taken through the admin tooling on a schedule and before each change, give you a human-readable copy of realm configuration that you can diff and reload into a lower environment. The resource manifests for the Keycloak, KeycloakRealmImport, KeycloakOIDCClient and KeycloakSAMLClient objects belong in version control, because the cluster state alone does not tell you what was intended. Confirm with your database team who owns restore rights and how long a restore takes in your own environment before you rely on the plan.

Upgrades should follow one path every time. First, read the upgrade notes for every minor release between your current version and the target, since behavior changes are documented there. For the 26.8 line, these include enforced SMTP StartTLS without plaintext fallback, mandatory signature validation of backchannel logout tokens from external providers, login failures persisted to the database by default, and a recommendation to move from the deprecated multi-site feature to the stateless feature. Second, apply the upgrade in a lower environment restored from a recent database backup, and run your sign-in, token refresh and logout tests against it. Third, approve the operator update. The Keycloak Operator documentation strongly recommends manual approval mode so that no upgrade starts without a named approver.

Schema migration deserves its own decision. Keycloak migrates its database schema automatically at startup by default. For large deployments, the upgrading guide suggests manual migration, where your DBA reviews and applies the SQL before the new pods start. Choose the mode in the lower environment first, measure how long the migration takes on a production-sized copy, and record the rollback path. Note that a schema change generally cannot be reversed by redeploying an older image, so the database restore point is your real rollback.

Hardening the Keycloak Operator deployment

These six items cover the operator deployment from the transport layer up to the upgrade path. Each one changes who can reach Keycloak, who can change its configuration, or which credentials could be exposed, so review them together before go-live. Treat them as a shared checklist for the platform and identity teams.

TLS on all communication

Keycloak's production guidance calls for TLS on all communication. In an operator deployment, that covers the browser-to-proxy hop, the proxy-to-Keycloak hop, the connection to the database, and outbound connections to LDAP, SMTP and external identity providers. Confirm which certificates the Keycloak custom resource references, who issues them, and whether each client and the database driver trust the full chain. Test each path directly, and do not assume the ingress covers it.

Separate admin and management endpoints

The production guide asks for the admin console and Administration REST API to sit on a different hostname or context path from public frontend URLs. Route only the public paths through the public hostname, and block admin paths there at the reverse proxy. Keep the management interface, which serves health and metrics, off the public route as well. Confirm that the ingress or route objects generated for the cluster expose exactly these paths, then test that the public hostname returns no admin responses.

RBAC on custom resources

The operator's custom resources (Keycloak, KeycloakRealmImport, KeycloakOIDCClient and KeycloakSAMLClient) can change sign-in behavior and client configuration for every application that depends on a realm. Limit create, update and delete rights on these objects to the teams that own identity configuration, and keep those rights separate from rights to read pods or secrets. Review role bindings on a schedule and audit changes through the Kubernetes audit log.

Least-privilege operator service account

The operator runs under its own service account, and the permissions it receives depend on the install method and on whether it watches one namespace or the whole cluster. Prefer namespace-scoped installs where the design allows, and review the cluster roles it is granted before approving the install. Check which secrets it can read, because it needs database and TLS material to reconcile Keycloak. Keep the service accounts of Keycloak pods separate and restrict their token mounts.

Secrets storage and rotation

Keycloak depends on database credentials, the bootstrap admin credential, TLS private keys and client secrets for registered clients. Decide whether these live in Kubernetes Secrets with encryption at rest, in an external secret manager synchronized into the cluster, or in both, and confirm which option your platform team supports. Document a rotation procedure for each item, covering the database password, certificate renewal and client secret regeneration, and rehearse it in a non-production environment first.

Upgrade checks for Keycloak 26.8

The Keycloak 26.8 upgrade notes call for checks before a cluster moves to this release. SMTP connections now enforce StartTLS without plaintext fallback, so confirm that each mail relay supports it and presents a valid certificate. Backchannel logout tokens from external providers now require mandatory signature validation, so test logout with every brokered identity provider. Read the full notes, and keep operator update approval set to manual while you test.

Questions teams ask before running Keycloak on Kubernetes

How much does it cost to run Keycloak on Kubernetes?

Cost comes from people, infrastructure, the database and ongoing upgrade work, and the written scope is the biggest factor in the total. Keycloak is open source under the Apache 2.0 license, so the software license is usually not the main line item in a community deployment. The Red Hat build of Keycloak is a supported distribution with its own subscription, which should be priced separately. Scope drivers include the number of realms and applications, directory integration, the high availability design, the number of environments and how much customization you need. Ask for a quote that separates one-time work (design, build, migration and go-live) from recurring work (upgrades, patching, monitoring and any support retainer), and ask which assumptions about your environment the estimate depends on. DeployOpen does not publish a price list. A quote follows from the agreed written scope.

How long does a first Keycloak deployment on Kubernetes take?

Length depends on scope, so the plan should show each milestone with its owner and its dependencies. A proof of concept on one cluster with a single realm and a few test clients moves much faster than a production build that includes a highly available database, several realms, LDAP or Active Directory federation and separate development, test and production environments. Timing is also set by how quickly your team provisions the database, approves DNS names and certificates, and makes decisions about realm structure and client ownership. Ask for the schedule broken into design, build, testing, cutover and handover, with the inputs you must supply in each phase. No duration is given here because it changes with those inputs.

What must our team provide before an engagement starts?

Your team must provide cluster access, a supported database, DNS names, TLS certificates and named identity owners before the build begins. Cluster access should allow the operator to be installed through Operator Lifecycle Manager or kubectl, and should allow creating namespaces, secrets and network policies. The database must be one of Keycloak's supported production databases, such as PostgreSQL 14 to 18, with backups in place and synchronous replication if you plan a highly available design. You need DNS for the public frontend and a separate hostname for the admin console, plus certificates that clients trust. Identity owners decide realm structure, password and MFA policy, and who approves client registrations. An SMTP relay that supports StartTLS is also needed, because Keycloak 26.8 enforces it. Ask for a written responsibility matrix that names who supplies each item.

Can an internal team deploy Keycloak on Kubernetes without outside help?

A platform team with Kubernetes experience can install Keycloak with the operator alone by following the operator documentation. The harder work sits around the install. Teams usually need experience with realm design, token and session settings, database operations for a highly available setup, reverse proxy and hostname configuration, and a repeatable process for testing each upgrade before production. Ownership also matters: someone must own the upgrade calendar, the realm configuration and the decision to manage clients as Kubernetes resources. Ask yourself whether the team has already run Keycloak or a similar identity service, whether it can staff the work alongside its normal duties, and who will answer for sign-in outages. If the answers are uncertain, a written scope with a handover plan can show where outside help adds the most value.

How does manual update approval affect our upgrade calendar?

Manual approval means a new operator version is not applied until someone on your team approves it. The operator documentation strongly recommends this mode to avoid unintended automatic upgrades. Keycloak plans four minor releases a year, so you should schedule a recurring review tied to that cadence. Each review should read the upgrade notes, because releases can change behavior, and the 26.8 notes include stricter SMTP, token validation and login failure storage. Test the upgrade against a copy of production realms and a copy of the database before approving it in production. Confirm in the operator documentation how the Keycloak image version is pinned and how approval interacts with it. Put the approval window in your change calendar so security releases can be scheduled without waiting for the next routine window.

How do we connect Keycloak to an external database on Kubernetes?

Keycloak connects to an external supported database, and the operator carries that connection in its Keycloak resource configuration. The database must be reachable from the Keycloak pods, and credentials should be stored in Kubernetes secrets rather than in plain configuration. Keycloak migrates its schema automatically at startup by default. For large deployments, the upgrading guide describes applying the schema SQL manually, which gives your database team a review step before changes land. Highly available designs need a synchronously replicated database, so plan the failover behavior with your database team. Confirm the exact field names and any connection options in the operator reference for your version, and test a restore of the database before go-live. Connection pool size and network policy should also be reviewed during load testing.

What usually goes wrong when Keycloak runs on Kubernetes?

Most problems trace back to hostnames, proxies, certificates and database behavior rather than to Keycloak itself. Incorrect public hostnames or proxy headers cause redirect loops, failed token issuers and broken logout. Certificates that clients do not trust stop sign-in before any user reaches the login page. Database connection limits or failover events during a rolling restart can cause login errors that look like application faults. Upgrades can fail when the schema migration is slow, or when a configuration that worked in an older release is changed by the new one. Realm imports can also overwrite changes made in the admin console if both are used without a clear owner. Before go-live, test sign-in through each reverse proxy path, confirm that the admin console is reachable only on its own hostname, and check that metrics and health endpoints report the expected state during a restart.

Should we manage clients as Kubernetes resources or in the admin console?

Managing clients as KeycloakOIDCClient or KeycloakSAMLClient resources keeps client definitions in version control and makes review and rollback part of your normal deployment process. The trade-off is that changes made directly in the admin console can drift from what the resources describe. Decide the ownership rule before the first client is created: either all clients are declared as resources and changes go through a pull request, or a defined group may edit clients in the console with changes exported back. Identity owners should approve redirect URIs, scopes and token lifetimes either way. Teams with many applications and frequent onboarding usually benefit from resources, while small deployments with few clients may find the console simpler. Ask the provider to show how client secrets are handled and how a client is recreated after a cluster rebuild.

How DeployOpen scopes, builds and hands over Keycloak on Kubernetes

DeployOpen plans, implements, hardens, documents and supports self-hosted Keycloak inside your own Kubernetes clusters and cloud accounts. We agree the scope in writing before work starts, then build the operator-managed deployment, realms and clients in a sequence your platform and identity teams can review.

How we scope

  • The written scope lists the clusters, namespaces, Keycloak versions and database engines covered by the Operator deployment.
  • We confirm which realms, clients and identity sources such as LDAP or Active Directory are in and out of scope.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before any build work begins.

How we build

  • We install the Keycloak Operator through Operator Lifecycle Manager or kubectl and set the update approval mode to manual.
  • We define the Keycloak, KeycloakRealmImport and client custom resources as code so changes go through your review process.
  • We connect Keycloak to a supported production database and test realm configuration in a non-production environment first.

How we hand over

  • You receive the manifests, realm exports and runbooks needed to redeploy, back up and restore the environment.
  • We document the database connectivity settings, TLS configuration and the admin console hostname separation from public endpoints.
  • We walk your platform and identity teams through the upgrade procedure, including how to read release notes before approving an operator update.

How we support

  • Ongoing support, operator upgrades and continuous testing are available as a retainer, scoped separately from the build.
  • Support can cover reviewing each Keycloak minor release for behavior changes before your team approves the update.
  • Confirm with us during scoping which monitoring, metrics and on-call responsibilities sit with DeployOpen and which stay with your team.

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.