Upgrading a multi-cluster Keycloak deployment

A planning guide for teams running Keycloak across two or more clusters: which upgrades can roll with zero downtime, the stop-all-but-one-site sequence for minor and major releases, and why mixed versions and asynchronous database replication are off the table.

On this page

Why multi-cluster Keycloak upgrades need a site-by-site plan

If your Keycloak runs across two or more clusters and must keep accepting sign-ins while you stay on a supported release, the planning question is which kind of release you are applying. Patch upgrades can be rolled out with zero downtime in a multi-cluster v2 deployment. Minor and major upgrades follow the documented sequence: stop all sites except one, upgrade and verify that site, then upgrade the remaining sites. That split should drive your change calendar, your maintenance windows and the number of people who must be available for each change.

Two rules shape every plan. First, sites cannot run different major or minor Keycloak versions at the same time, so a mixed-version state is not a supported way to get through an upgrade. Second, the database must stay synchronously replicated during the upgrade, because disabling synchronous replication can cause data loss during failover. Confirm with your database team how synchronous replication is configured for your engine before the change window, and confirm that your failover tests still pass on the release you are moving to. Your site-by-site order also depends on which site will be upgraded first and how you will verify it before the others follow.

Release cadence makes this a recurring task, not a one-time project. Since Keycloak 26.0, the project plans four minor releases a year and a major release every two to three years, and its current release is 26.8.1. Plan for a standing upgrade rhythm that covers both patch and minor releases. The multi-cluster v1 design, which used a separate Infinispan cluster per site, is deprecated, and the project recommends moving from the deprecated multi-site feature to the stateless feature. If your deployment still depends on either, treat that migration as part of your upgrade roadmap and confirm the target architecture with your Keycloak support provider before you schedule it.

What changed in the 26.8 line that affects multi-cluster sites

This table lists the four 26.8 upgrade-note changes that matter most for a multi-cluster v2 deployment, with the impact on each site and the action to take before upgrading. Read each row as a pre-upgrade checklist item, and confirm against the 26.8 upgrade notes for your exact target version, since breaking changes in minor releases are opt-in under the project's compatibility policy.

Change in 26.8Impact on a multi-site deploymentAction before upgrading
SMTP StartTLS enforced without plaintext fallbackEach site sends email on its own path. A site whose relay offers only plaintext will fail to send password reset and verification mail, and sites may differ if their relays differ.Confirm every site's SMTP relay supports StartTLS with a valid certificate, and test a send from each site before the first site is upgraded.
Mandatory signature validation of backchannel logout tokens from external providersLogout requests from external identity providers brokered at one site may be rejected, leaving sessions open at that site. Behavior can differ between sites if their broker configuration differs.Inventory brokered providers that send backchannel logout, confirm their signing keys are published and configured in each realm, and test logout at every site.
Login failures persisted to the database by defaultFailed-login records are written to the shared database, so write volume and table growth rise on every site that shares it. Storage and retention planning must cover all sites together.Estimate the extra write load on the synchronously replicated database, set a retention policy for the event data, and confirm replication keeps pace during the test window.
Recommendation to move from multi-site to the stateless featureThe deprecated multi-site feature is the mode most multi-cluster v2 teams currently run. The project recommends moving to the stateless feature, so the target architecture and the upgrade sequence may change together.Decide with the vendor documentation and your architect whether to migrate during this upgrade or in a separate change, and do not mix the two in one maintenance window without a tested rollback.

What to prepare before touching any site

A multi-cluster upgrade fails in the database, in the configuration drift between sites, or in the custom code nobody tested. The six items below are the work to finish before any site is stopped, and each one gives you a way back if the upgrade goes wrong.

Restorable database backup

Take a backup of the shared database that you have actually restored once in a test environment. Because every site depends on the same database, a schema migration that goes wrong affects all sites at once. Confirm the backup covers the full schema and that you know who can start the restore and how long it takes in your environment.

Upgrade guide

Site and version inventory

Record every site, the Keycloak version and build each one runs, and the cache and Infinispan settings it uses. Mixed major or minor versions across sites are not supported, so this inventory tells you which sites are out of step before you begin. Note the node count and any site-specific configuration that differs from the others.

Custom providers and client libraries

List every custom SPI provider, theme, and client library that runs against this deployment, including the versions they were built for. Each one must be rebuilt or retested against the target release before any site is upgraded. An illustrative example: a custom authenticator compiled against an older release may fail at startup on a newer one, and you want to learn that in staging.

Synchronous replication confirmed

Confirm in writing with the database team that synchronous replication is enabled and will stay enabled for the whole upgrade. The upgrade guide states that disabling it can cause data loss during failover. Check the replication mode on the primary and the standby, and record the result so the change window does not depend on memory.

Staging multi-site environment

Build a staging environment with the same number of sites, the same database replication setup, and the same cache topology as production. A single-node test does not exercise the stop-all-but-one sequence or the cross-site behavior you are changing. Use it to rehearse the full procedure, including the verification step on the first site.

Health and metrics baseline

Enable metrics with --metrics-enabled=true and record a baseline from the /metrics endpoint on the management interface for each site before the change. Capture login success rates, error counts, and cache behavior under normal load. Without this baseline you cannot tell whether the upgraded site behaves differently from the ones still running the old version.

Metrics guide

When a patch upgrade can roll with zero downtime

For a multi-cluster v2 deployment, a patch upgrade can be deployed with zero downtime, while a minor or major release follows a different sequence that stops all sites except one. The first decision is therefore classification: confirm that the target version is a patch release within the same minor line as the version you run now. Compare the current and target version strings across every site, since a patch path only applies when each site is already on the same minor line before the change starts. If the sites differ in minor version, stop and resolve that mismatch first, because running different major or minor versions across sites is not supported.

Classifying the version number is necessary but not sufficient. The release notes for the specific target version decide whether the rolling path is safe, so read them for that exact release before scheduling work. Look for any upgrade step, schema change, configuration change or default change that the notes mark as required, and treat any such item as a reason to plan the sequence for a minor upgrade instead. Confirm this with the Keycloak multi-cluster v2 upgrades guide and the release notes for your target version, and record the result in your change ticket so the approver can see which path was chosen and why.

The mechanics of the rolling restart, including the Operator's rolling update strategy and sticky-session behavior, are covered in the zero-downtime patch guide, so this section does not repeat them. Before you start, confirm that database replication stays synchronous for the whole window, because the multi-cluster guidance keeps synchronous replication enabled during database upgrades to avoid data loss during failover.

How to run the stop-all-but-one-site upgrade sequence

The sequence upgrades a multi-cluster Keycloak deployment to a new minor or major release one site at a time, so one verified site carries sign-in while the others wait. It produces a fully upgraded deployment with a rollback point at each stage.

  1. Confirm the target release and its upgrade notes

    The platform owner and the Keycloak lead confirm the exact target version and read its upgrade notes and every breaking change that applies to the deployment, including any opt-in changes that must be enabled deliberately. Check custom providers, themes and client configuration against those notes before anything changes. Record the target version, the sites in scope and the named person who approves the change. The step is done when the team can state which behavior changes they expect and which they have tested. Rollback point: nothing has changed yet, so the team can stop here at no cost to the running system.

  2. Take and verify a database backup

    The database administrator takes a backup of the shared Keycloak database and confirms that it can be restored. Verify the backup by restoring it to a separate environment or by an equivalent test your database team already uses, and confirm that the replication topology is healthy and synchronous before the change starts. Keep the backup until the upgrade is accepted, not just until the first site starts. The step is done when a restore has been demonstrated and the backup identifier is recorded in the change ticket. Rollback point: the verified backup, which is the only recovery path if schema migration fails.

  3. Stop all sites except one

    The operations team stops Keycloak on every site except the one chosen as the pilot, so that only one site remains active against the database. Confirm with load balancer and monitoring that traffic is directed to the remaining site and that the stopped sites no longer accept requests. Keep synchronous replication enabled throughout this step, since the database must stay consistent while the sites are changed. The step is done when only the pilot site is serving traffic and the stopped sites show no active instances. Rollback point: the stopped sites can be restarted on the existing version, since they have not yet been upgraded.

  4. Upgrade the pilot site and confirm schema migration

    The team deploys the new version on the pilot site and lets Keycloak run its database schema migration at startup, or runs the migration manually if the deployment uses that method. Watch the startup logs and the database for the migration to finish and for the server to report that it is ready. Do not start any other site on the new version or on the old version during this stage. The step is done when the migration completes without errors and the pilot site reports healthy. Rollback point: the verified backup from step two, since a failed schema migration is the point of no return for the old version.

  5. Verify the pilot site before continuing

    The QA or platform team checks the pilot site with a defined test set. Confirm that users can sign in, that tokens are issued and validated by a test client, that administrators can open the admin console, and that the metrics endpoint responds if metrics are enabled. Review logs for errors that appear after the migration. The step is done when every check in the agreed test set passes and the approver signs off in the change ticket. Rollback point: if checks fail, the team must restore the database from the verified backup, because the pilot site cannot run the previous version against a migrated schema.

  6. Upgrade the remaining sites one at a time

    After sign-off, the team brings up the remaining sites on the new version, one site at a time, and checks each before starting the next. Each site runs the same verification as the pilot, with particular attention to session behavior, cache consistency and load balancer routing. Do not run the new and old versions side by side at any point, because mixed major or minor versions across sites are not supported. The step is done when every site runs the target version, passes its checks and receives traffic under normal load. Rollback point: until the last site is verified, the team should keep the backup and the change record so that recovery remains possible.

  7. Close the change and retain the evidence

    The team confirms the final state across all sites, records the version, the migration results, the verification outcomes and the backup identifier in the change record, and sets a retention period for the backup that the organization's policy requires. Remove any temporary maintenance settings and confirm that monitoring alerts are back to normal levels. The step is done when the change record is complete and the owner has accepted the upgrade. Ask your DeployOpen or internal change process to confirm how long backups are kept, since this depends on your own policy.

Stopping all but one site keeps mixed versions out of the cluster

The diagram starts with every site on the old version and a single synchronously replicated database shared by all of them. Sites B and C are stopped, leaving Site A as the only running site. Site A is upgraded and verified, and that check ends in a go or rollback decision. Only after a go decision are the remaining sites restarted on the new version, one at a time. Mixed versions are not allowed at any point, so no site runs the new release while another still runs the old one.

Stop-all-but-one-site sequence for a minor or major upgrade across sites.

Why mixed versions and asynchronous replication are off limits

Running different major or minor Keycloak versions across sites is not supported, so an upgrade of a multi-cluster v2 deployment is a planned window in which some sites are stopped, not a long period where old and new versions serve traffic side by side. The documented sequence stops all sites except one, upgrades that site, verifies it, and only then upgrades the remaining sites. Plan the window around that sequence: decide in advance how much capacity the single active site must carry, who signs off on verification before the second site starts, and how users will be routed while only one site is up. A patch release is the exception, since the zero-downtime path applies there, but confirm the release type before you choose a runbook.

Database upgrades must keep synchronous replication enabled. Both supported multi-cluster designs depend on a synchronously replicated database, and disabling replication during the upgrade can cause data loss during failover. Check how your chosen platform from the supported list (PostgreSQL, MySQL, MariaDB, Oracle Database, Microsoft SQL Server, Aurora PostgreSQL, Azure SQL or EnterpriseDB Advanced) implements synchronous replication, and confirm with your database team which replica settings, failover behavior and replication lag limits apply during the schema change. Do not treat a replica-lag alert as a reason to switch to asynchronous mode mid-upgrade.

The schema migration setting determines when that database work happens. By default, Keycloak migrates its schema automatically at startup, which means the first upgraded site changes the shared database that the other sites still depend on. For large deployments, the upgrading guide suggests manual migration, where administrators apply the SQL themselves and review it first. Choose the mode before the window opens, rehearse it on a copy of production, and record which site runs the migration. Confirm the procedure against the Keycloak multi-cluster v2 upgrades guide and the version-specific notes in the upgrading guide.

What makes a multi-cluster upgrade take longer

Does the number of sites change how long a Keycloak multi-cluster upgrade takes?

Yes. Each additional site adds a verification pass, because the documented sequence for minor and major releases stops all sites except one, upgrades and verifies that site, then upgrades the remaining sites. More sites mean more stop and start cycles, more coordination with the teams that own each cluster, and more checks that all sites are back on the same version before traffic is restored. Sites spread across availability zones usually add time for network and failover testing, since you need to confirm that the database and the Keycloak nodes in each zone behave correctly during the upgrade window. Confirm your site count, zone layout and failover runbook with your platform team before planning the window.

How does database size affect the schema migration during a Keycloak upgrade?

Larger databases generally take longer to migrate, so the schema step is often the longest part of a major or minor upgrade. Keycloak runs schema migration automatically at startup by default, which is simple but ties the work to the startup of the first upgraded node. The upgrading guide suggests manual migration, where your DBA applies the SQL ahead of time, for large deployments. Manual migration adds a review and scheduling step but lets you test on a copy and measure the run. Ask your database team to size the largest tables, confirm a restorable backup exists, and choose the migration method before the change window is set.

Why do custom SPI providers and themes make a Keycloak upgrade slower?

Custom providers and themes are compiled or packaged against the Keycloak release they were built for, so each one must be rebuilt, retested and sometimes rewritten for the target version. The work grows with the number of providers, the depth of changes to login and account pages, and how many internal APIs they call. Providers that touch authentication flows, user storage or token handling need the most testing. Ask for an inventory of every custom artifact, its owner and its test cases so the rebuild and retest effort can be estimated before the upgrade is scheduled.

How do client applications and keycloak-js versions affect upgrade timing?

Client applications depend on server behavior such as token contents, logout handling, redirect rules and the client libraries they use, so a server upgrade can break applications that were never changed. Single-page apps built on keycloak-js are a common source of delay because their adapter version must match the server's expectations and their token handling must be retested. The longer the list of applications and the more teams that own them, the more coordination the window needs. Build an inventory of each client, its library version and its sign-in and logout tests, and agree with each application owner on who signs off.

How many realms and clients need to be verified after a multi-cluster upgrade?

The verification effort scales with the number of realms, clients, identity providers and authentication flows that users depend on. Each realm may have its own login flows, brokered identity providers, user federation links and client scopes, and each needs a check after the upgrade on every site that serves it. Verification also multiplies across sites, because the test must confirm that sign-in, token refresh and logout behave the same on the site that was upgraded first and on the sites upgraded later. Ask for a list of realms with their clients and dependencies, and a test matrix that records which checks run on which site.

Which monitoring and approval steps add time to each checkpoint?

Every checkpoint in a staged upgrade usually needs monitoring signals and a documented go or no-go decision, and both take time under change control. Operators typically watch login error rates, database health, cache and cluster state and Keycloak logs before they accept a site and move on. Where the organization requires a change advisory board or security sign-off, each stop point becomes a scheduled approval rather than an operator decision. Confirm which metrics your team already collects from the metrics endpoint, which thresholds define a failed checkpoint and who can approve a rollback before the window is booked.

Does your team's experience with the database platform change the upgrade effort?

Yes. Keycloak supports several production databases, and an upgrade goes faster when the team already knows how to take consistent backups, check replication state, handle synchronous replication during failover and run a schema change safely on that platform. A team new to the database may need extra time to learn the tooling, rehearse failover and confirm that synchronous replication is still enabled during the database upgrade, since disabling it can cause data loss during failover. Check the supported database list in the Keycloak database guide against your current platform, and ask whether your DBAs have rehearsed a restore and a failover on the target version.

How to test each site and roll back safely

Test each site before the next one moves. For every upgraded site, run a fixed verification set against the site's own load balancer or ingress, not the shared front door, so you know which site answered. The set should cover sign-in flows for representative clients (one browser app, one confidential back-end client, and one client that uses a native or mobile flow if you have one), token issuance and refresh, and logout including backchannel logout to each relying party. Add an SMTP test under the StartTLS enforcement that 26.8 introduces, because a server that refuses plaintext fallback will fail password reset and notification mail in ways that sign-in tests will not reveal. Check admin console and Administration REST API access through the restricted hostname or context path, and confirm that the /metrics endpoint on the management interface and the health endpoints report the new version and healthy caches. Confirm the exact health and metrics paths for your release in the observability documentation before you script these checks.

Make the rollback decision per site, and make it before the next site leaves the stopped state. Because the documented minor and major sequence stops all sites except one, the site you just upgraded is the only one running the new version, so a failed check there is cheap to reverse. Once a second site is upgraded, mixed versions are no longer an option, and rolling back one site alone is not a safe move. Treat the pre-upgrade database backup and the point at which you stopped the other sites as the rollback boundary: restoring the schema from before the migration and restarting the old version on every site is the only supported path back. Ask your team to write down, for each step, who has authority to call a rollback and what evidence triggers it.

Rehearse the full procedure in staging before production. The staging environment should mirror the production topology, the database replication mode, and the proxy configuration, and it should include a realistic set of realms and clients, including any custom providers. Time the backup restore and confirm that it works from the backup file you will actually use. Confirm with your Keycloak support provider or the vendor documentation that the rollback path you rehearsed matches the version pair you are moving between, since schema changes differ by release. Record the results so the production runbook reflects what you tested, not what you expect.

Questions teams ask before upgrading a multi-cluster Keycloak

How much does upgrading a multi-cluster Keycloak cost?

The cost depends on the written scope, which sets the work for each site, the database, the customizations and the testing. DeployOpen does not publish a price list, so a quote follows from the agreed scope. Ask the quote to separate planning and environment review, the upgrade of each site, database work, testing of custom providers and themes, and handover documentation. Ask whether each item is one-time or recurring. Costs rise with the number of sites, the size of the database, custom SPI providers and themes, and the number of applications that need regression testing after each release. Your own team's time for approvals, backups and test users is a cost to include in your internal budget.

How long does a multi-cluster Keycloak upgrade take?

The duration depends mainly on the number of sites, the size of the database and whether the release is a patch or a minor or major version. A patch can be applied with zero downtime in a multi-cluster v2 deployment, while a minor or major release follows the documented sequence of stopping all sites except one, upgrading and verifying that site, then upgrading the remaining sites. Each site needs its own verification window, and a large database schema migration can extend the work. Ask for a timeline that lists each site, the verification steps and the change windows, rather than one overall figure.

What does our team need to provide for the upgrade?

The work needs access to the infrastructure in each cluster, including the Keycloak deployments, load balancers, reverse proxies and monitoring, along with the database administration rights needed to take and test backups. You will also need a restorable database backup taken before the upgrade, test users and realms that represent real login flows, and a list of the applications and clients that depend on Keycloak. Change approvals for each stopped or upgraded site must be scheduled in advance. Confirm these requirements with your change board and security team before the scope is signed.

Can our own team run this upgrade without a partner?

Yes, a capable platform team can run the upgrade if it follows the documented multi-cluster v2 sequence and has the access, backups and test coverage described in the upgrade guide. The guide requires that sites run the same major and minor version, that synchronous database replication stays enabled during database upgrades, and that one site is stopped, upgraded and verified before the others move. Most teams weigh the internal time for testing custom providers, rehearsing the sequence and documenting the result. Ask your team to rehearse the sequence in a non-production environment first.

Can we skip the staged sequence for a patch release?

For multi-cluster v2 deployments, the documented guidance is that patch upgrades can be deployed with zero downtime, so the stop-all-but-one-site sequence is reserved for minor and major releases. Confirm the release type against the upgrade notes before you choose a path, because a release that is labeled as a patch may still include changes that need planning. Running different major or minor versions across sites is not supported, so all sites must reach the same version before the deployment is considered complete.

Why does database replication have to stay synchronous during the upgrade?

Keycloak's multi-cluster v2 guidance says database upgrades should keep synchronous replication enabled, because disabling it can cause data loss during failover. This matters during an upgrade because a failover in the middle of a schema change or a version transition could leave sites working from different data. Your database team should confirm that synchronous replication is configured and healthy before starting, and that it stays in place for the whole window. Ask the team to document how replication will be checked at each step.

Does a managed retainer cover future Keycloak upgrades?

DeployOpen offers ongoing support, upgrades and continuous testing as retainers, and the scope of each retainer is set in writing. Ask whether the retainer covers patch releases, the quarterly minor releases, major releases, the testing of custom providers and themes, and the rehearsal of the multi-cluster sequence in a non-production environment. Also ask how upgrade timing is agreed with your change process, and how the retainer is priced and renewed. Confirm these terms in the written scope rather than assuming them.

What should we check in the upgrade notes before approving the change?

Read the upgrade notes for every version between your current release and the target, not only the newest one. Look for changes that affect your environment, such as opt-in breaking changes, configuration changes, and any move away from deprecated features like the multi-site feature. For example, Keycloak 26.8 notes include enforced SMTP StartTLS and mandatory signature validation of backchannel logout tokens from external providers. Confirm which of these changes apply to your sites and whether your applications and mail relay still work after the upgrade.

How DeployOpen scopes and delivers a multi-cluster Keycloak upgrade

DeployOpen plans and carries out Keycloak upgrades inside the client's own infrastructure, treating each site, database and replication link as part of one upgrade plan. The work starts with a written scope that names every cluster, the target release and the upgrade path, so the stop-all-but-one-site sequence is agreed before any change is made.

How we scope

  • Inventory every cluster, site, database node and replication link, and confirm the current and target Keycloak versions for each.
  • Confirm whether the deployment uses the multi-cluster v2 architecture and whether any site still runs the deprecated multi-site feature.
  • Agree in writing whether the change is a patch upgrade or a minor or major move, since each follows a different sequence.

How we build

  • Build a staging copy of the multi-cluster topology and rehearse the site-by-site upgrade order, including the verification step on the first site.
  • Confirm synchronous database replication is on before each upgrade step, and document how it is checked during the database migration.
  • Test sessions, login, token issuance and logout against client applications on the upgraded site before the remaining sites are brought up.

How we hand over

  • Deliver a runbook with the exact order of site shutdowns, upgrades, verification checks and rollback points for your environment.
  • Document the database backup taken before schema migration, the migration method chosen and the evidence that replication stayed synchronous.
  • Walk your platform and security teams through the runbook and record the test results they will need for change reviews.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing for each new Keycloak minor release are available as a retainer.
  • Ask any provider to confirm how they handle version compatibility checks and whether their rollback steps have been rehearsed.

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.