How to move a live Keycloak 25 deployment to 26 without losing sessions
Moving from Keycloak 25 to 26 is a planned rolling change to a stateful identity service, and the main risk is session loss, followed by schema and configuration drift. Users signed in to your applications hold sessions that Keycloak tracks in memory and in the database. If a node is replaced without a plan for those sessions, users are sent back to the sign-in page mid-task, and a large user base signing in again at the same moment creates its own load. Schema and configuration drift are the second risk: one node may run the new release against a database schema the others still expect in its old form, or settings may differ between old and new nodes during the window when both run.
The supported path is to move to a 26 release first, then keep pace with the 26 minor releases. Since Keycloak 26.0, the project has planned four minor releases a year and says breaking changes in a minor release will be opt-in, as stated in its October 2024 release update. That cadence means the target minor is a decision you make deliberately, not a default you inherit. The current release is 26.8.1, published October 13, 2026. Choosing between the current release and an earlier 26 minor depends on which changes you can absorb, your database and cluster setup, and the custom code you run. Confirm the target against the Keycloak 26 upgrading guide, which lists the changes that apply to each release.
Before you change any node, write down the facts the upgrade depends on: the exact 25 version in production, the database engine and version, the cluster topology, every realm and client setting that deviates from defaults, and each custom provider or theme. Compare these against the upgrading guide for your chosen target. The supported production databases include PostgreSQL 14 to 18, so confirm that your engine and version fall in the supported set for the release you choose. Decide whether the database schema migrates automatically at startup or whether your database team applies the migration SQL manually, since the upgrading guide suggests manual migration for large deployments. Record who makes that call and when.
Run the whole sequence in a staging environment built from production configuration, with a session test that signs in a representative set of users, keeps them active through each restart, and checks whether they stay signed in. Ask your team or your implementation partner for a written runbook that names the order of node restarts, the checkpoint for each step, and the rollback path if a node fails the health check. If you run Keycloak on Kubernetes through the Operator, the Operator documentation strongly recommends manual approval mode for operator updates, so each change is applied on purpose rather than by surprise.
What changes in the 26 line and what each change requires from you
This table lists the Keycloak 26 line changes most likely to affect a 25 to 26 move, with the impact on a running deployment and the action each one requires from your team. Use it as a planning checklist and treat the Keycloak 26 upgrading guide as the complete list of 25 to 26 changes, because those notes are the authority for your target version.
| Change | Impact | Action needed |
|---|---|---|
| Automatic schema migration at startup | Keycloak migrates the database schema automatically at startup by default. Large deployments can apply the SQL manually. | Choose automatic or manual migration, then rehearse the upgrade on a restored copy of production data. |
| Supported production databases | PostgreSQL 14 to 18 is listed as supported, along with other engines in the database guide. | Confirm your database version is in the supported list and schedule any database upgrade separately. |
| Enforced SMTP StartTLS in 26.8 | Mail connections that cannot negotiate StartTLS fail. There is no plaintext fallback. | Verify your mail relay supports StartTLS and that certificate trust is in place before moving to 26.8. |
| Signature validation for backchannel logout tokens | Logout tokens from external providers must pass signature validation in 26.8. | List external identity providers that send backchannel logout and confirm their signing keys are configured. |
| Login failures persisted by default | Failed login records are written to the database by default, which adds write load and storage growth. | Review database sizing and retention for login failure data, and confirm monitoring covers it. |
| Multi-site feature moving to stateless | The multi-site feature is deprecated, and the upgrade notes recommend the stateless feature instead. | Identify any multi-site deployment and plan the move to the stateless feature with your architecture owner. |
| Opt-in breaking changes in minor releases | Breaking changes in minor releases are opt-in, so you must enable them deliberately. | Read the notes for each minor release and enable only the options your deployment needs. |
Why enabling persistent sessions first protects logins during the Keycloak 26 upgrade
The session strategy has to be settled before the version change because it determines whether users stay signed in while the upgrade runs. Keycloak keeps user and client sessions that record who is signed in and which tokens have been issued. If those sessions live only in memory or in a distributed cache, every node restart removes the sessions held on that node. A version change adds risk, because cached data written by the old release may not be read cleanly by the new one. Without a change to session storage, users could be asked to sign in again across every application that relies on Keycloak, at the moment your teams are watching the upgrade most closely. Moving sessions into the database first means a node restart no longer depends on what happens to be in the cache.
Persistent sessions have a cost in the database. Each session is written to and read from the database, so write volume and table growth rise with login volume and session lifetime. Before enabling the setting, read the upgrading guide for your target release and confirm three things: the exact name of the persistent session setting and whether it is a feature flag or a configuration option, which database tables it touches, and how expired sessions are cleaned up. Ask your database administrator to estimate the write load at your busiest login hour and to size storage for the session tables. Confirm that your production database engine and version appear on the supported list for the release you are moving to, because the upgrading guide governs what is supported. Take a verified backup before the change so that you can reverse it if the load is higher than expected.
The Protostream cache change is the second reason to review sessions first. Protostream is the serialization format Keycloak uses to encode objects stored in its distributed caches. When that encoding changes, cache contents written under one release may need to be discarded or rebuilt when nodes move to the next one. During a rolling update, nodes on different versions can also disagree about what they read from the same cache. Treat the cache configuration as an item to review line by line. List every cache customized in your current deployment, identify any custom providers that store objects in a cache, and read the upgrading guide's instructions for clearing, migrating or rebuilding cache data for your target release. Record the decision for each cache so that the change board can see what was reviewed and why.
Test the behavior in staging before production. Build a staging environment from a copy of your production configuration, including the same number of nodes, the same database engine and the same proxy path. Sign in with several test users, keep sessions open in each connected application, and then restart each node one at a time while the others continue serving requests. After every restart, confirm that existing sessions still validate, that token refresh succeeds and that logout reaches the applications. Repeat the test after the cache configuration and session settings are in place. Record every session that is lost, the node and step where it happened and the log messages from that point. Do not schedule the production change until each lost session has a documented cause and an accepted fix. Your identity team owns this sign-off, and DeployOpen can run the test as part of a fixed-scope engagement if you want an outside check.
Backups, inventory and a test environment to prepare before the upgrade
Five preparation items come before any change to the production instance. Each answers one question: can we restore, what depends on this deployment, does the upgrade work on a copy of our setup, which settings move between releases, and what exactly is the starting point. Together they give the team a tested fallback and a baseline to compare against.
Database backup and restore test
Take a full backup of the production database before the upgrade starts, then restore it into a separate instance and start Keycloak against it. Confirm that your database engine and version appear on the supported list in the Keycloak database guide, which includes PostgreSQL 14 to 18. Record how long the restore took and whether Keycloak started cleanly with the restored data. A backup that has never been restored is unproven, so this test is the only evidence you have that rollback is possible.
Inventory of realms and integrations
List every realm, client, identity broker, user federation link, custom SPI and theme in the deployment, with its owner and the release it was built against. Custom providers and themes are the items most likely to fail after the upgrade, so they need the closest review. For each LDAP or Active Directory federation and each external identity provider, note the bind account, sync schedule and redirect URIs in use. Store the inventory with the change record so every later check has a baseline.
Staging environment from a production copy
Build a staging environment from a recent copy of production that uses the same database engine, reverse proxy and TLS setup. A staging instance behind plain HTTP or a different proxy will not reproduce the hostname, forwarded headers and certificate chain that real users pass through. Run the full upgrade there first, then test sign-in, token refresh, logout and each custom provider. Mask or replace personal data in the copy if your data protection rules require it.
Settings that change between releases
Review hostname, proxy header, SMTP and other settings against the upgrade notes for every release between your current version and the target. Hostname and proxy header handling determine how Keycloak builds issuer and redirect URLs, so a mismatch can break sign-in for every client at once. If the target includes the 26.8 changes, SMTP requires StartTLS without plaintext fallback, so test password reset and notification mail against your relay before cutover. Write each changed setting down with its current and new value.
Version record and Operator approval mode
Record the running Keycloak version, the image or distribution build, and the complete configuration before any change is made. If the deployment runs on the Keycloak Operator, set the update approval mode to manual so the Operator cannot upgrade Keycloak without a person reviewing the change first. The Operator documentation strongly recommends this mode to avoid unintended automatic upgrades. Keep this record with the inventory so a rollback has a known target.
Checking hostname v2 and proxy headers before cutover
Hostname and proxy configuration is one of the most common reasons a Keycloak upgrade passes in a test environment and then breaks in production. When the server builds URLs from the wrong host, scheme or port, users land on broken redirects, relying applications reject tokens because the issuer does not match what they expect, and administrators cannot reach the admin console. These failures often appear only after the server runs behind the real load balancer and reverse proxy, so this check belongs before cutover and should be planned as its own work item.
Start from the production guidance in the Keycloak documentation. It calls for TLS on all communication, a reverse proxy with path restrictions, and the admin console and Administration REST API served on a different hostname or context path from public frontend URLs. Before you change anything, write down the decisions these requirements force: the public hostname users and applications see, the separate hostname or path for administration, which paths the proxy forwards to the internet, and where TLS terminates and whether traffic is re-encrypted before it reaches Keycloak. Record how the current 25 deployment answers each question so you can see what the upgrade changes.
Then verify the outputs that break first. Fetch the OpenID Connect discovery document for a test realm and confirm that the issuer and endpoint URLs use the public hostname and scheme that clients expect. Compare the issuer claim in a freshly issued token with the value each relying application has configured. Check that every registered redirect URI matches the URL the server generates, including port and path. Confirm that the admin console and Administration REST API respond from the management network and are refused from the public internet, and that the metrics and health endpoints are not reachable from public addresses.
The exact hostname v2 and proxy-header settings for your target release must be confirmed in the Keycloak 26 documentation for that release, not copied from a 25 configuration file. Work through those settings in a staging environment that matches production: the same proxy chain, certificates, DNS names and forwarded headers. Record the issuer values and redirect behavior before and after the change, and repeat the admin access tests from both networks. Ask any implementation partner to state in the written scope which staging environment, proxy configuration and test cases they will use to sign off this step.
The Keycloak 26 upgrade sequence with checks and rollback points
This sequence moves a Keycloak 25 deployment to 26 in an order where each step has a pass or fail check and a defined rollback point. It ends with a recorded sign-off that names the backup kept as the restore point, so the team knows exactly what it can reverse and how.
Freeze configuration and take a backup
Freeze realm, client and identity provider changes in your change tracker for the upgrade window, and export the realm configuration. Take a full database backup with the native tooling for your supported database, then restore it into a separate environment and start Keycloak against the restored copy. The check passes when the restore completes and the restored copy shows the same realm and user counts as production. Rollback point: this tested backup is the only restore point once schema migration begins, so keep it until the upgrade is accepted.
Upgrade staging and run the full tests
Deploy the target release to a staging copy built from the restored backup, using the same database engine, reverse proxy, hostname settings and cluster shape as production. Run the full test set: sign-in for every client, federation sync, brokered logins, admin console and Administration REST API calls, and tests for each custom provider. The check passes only when every test succeeds and the logs show no new errors or warnings tied to the upgrade. Rollback point: staging is reset or discarded, and production is untouched.
Review migration notes for every minor release
Read the upgrade notes for each minor release between your current 25.x version and the target, and record every change that touches your realms, clients, providers, SMTP, hostname or proxy configuration. Breaking changes in a minor release are opt-in, so each one needs a recorded decision: adopt it, leave it off, or change configuration to match. Assign an owner to each item. The check passes when every recorded change has a decision and an owner. Rollback point: this step changes nothing in the system, so if an item cannot be resolved, stop before migration.
Choose automatic or manual schema migration
Keycloak migrates the database schema automatically at startup by default. For a manual migration, generate the SQL for the target release, have a database administrator review it for locking, long-running statements and effects on your database engine, and apply it to the restored staging copy first. Confirm in the upgrading guide how the SQL is generated for your version. The check passes when the review is signed off and staging starts cleanly with the SQL applied. Rollback point: Keycloak does not reverse a schema change, so rollback after migration means restoring the tested backup.
Upgrade one node or rolling restart
Remove one node from the load balancer, upgrade it, start it and confirm it joins the cluster before moving to the next node. Watch the health endpoint, the cluster membership count, and the startup logs for migration errors or repeated restarts. Before starting a rolling restart, confirm in the upgrade notes whether nodes on different versions may run together, because that answers whether the first upgraded node changes the schema for the whole cluster. The check passes when each node reports healthy and error rates in the logs stay at their baseline. Rollback point: stop the upgraded node and revert it, which works only while the schema is still compatible with the previous version.
Verify sessions, logins, federation and metrics
Confirm that existing user sessions survive the upgrade and that new logins succeed for each client. Run a federation sync against your LDAP or Active Directory provider, test a brokered login through each identity provider, and check the admin console. If metrics are enabled with --metrics-enabled=true, confirm the Prometheus-format endpoint at /metrics on the management interface returns data and that scraping and alerting still work. The check passes when every test matches its pre-upgrade result. Rollback point: if a check fails, pause the rollout and decide between a targeted fix and restoring the backup.
Confirm the rollback point and close
Record the backup identifier, the previous image or package, and the time window in which rollback remains practical. Ask the system owner and security lead to sign off on the upgraded production cluster, and confirm the rollback path was tested in staging. Keep the backup and the previous release available until that sign-off is recorded. The check passes when the sign-off record names the backup and the rollback path. Rollback point: after the backup is retired under your retention policy, any later reversal means restoring an older backup and losing changes made since.
Testing custom providers and logins against the new Keycloak release
Every custom authenticator, event listener, user storage provider, theme and protocol mapper must be rebuilt against the Keycloak 26 API and retested on the target release before you cut over. These components are compiled against Keycloak's internal interfaces, so a build that succeeded on 25 can still fail at startup, be silently skipped, or behave differently at runtime. Inventory every custom artifact, record which Keycloak version each one was built for, and rebuild them from source against the release you plan to run. Deploy them to a staging instance that uses a copy of your production realm configuration and a restored copy of the database, so the test reflects the data your users actually have.
Build the test matrix around the flows your users depend on. For each client type, cover browser-based confidential web applications, public single-page applications using PKCE, native and mobile clients, and service accounts that use client credentials. For each, sign in with a standard user, a user with custom attributes, and a user who needs a second factor or passkey. Add brokered logins through every upstream OIDC, SAML and social provider you have configured, and run LDAP or Active Directory sync in both full and changed-user modes, checking group and role mappers and any custom user storage behavior. Confirm the token claims in ID and access tokens match a baseline captured from the current 25 deployment for the same test accounts, paying particular attention to custom protocol mappers.
Logout and messaging need their own cases because they touch external systems. Test front-channel logout from the browser and backchannel logout from each relying party, and confirm that sessions end in every application that should end them. Send a password reset, an account verification and an admin notification through SMTP and check delivery, headers and the TLS negotiation with your relay. Finally, exercise admin actions in the console and through the Administration REST API, including realm changes, client creation, user disablement and any custom admin extensions. Write down the expected result for each case before the run, so a failure is a clear defect rather than a judgment call.
The 26.8 changes can break flows that worked before. Keycloak now enforces StartTLS for SMTP without plaintext fallback, so a mail relay that offered only unencrypted delivery or presented an unexpected certificate will fail email silently for some users. Mandatory signature validation of backchannel logout tokens from external providers can reject logout requests that were previously accepted without verification, leaving sessions open in relying parties. Login failures are also persisted to the database by default, which changes database load and may affect any custom event listener that assumed otherwise. These behaviors must be tested on the exact target version, because a check that passed on an earlier 26.x release does not prove the later one behaves the same way.
Before the upgrade window, confirm which 26.x release you will run and freeze it for the test cycle. Ask your partner or internal team to deliver the test plan, the expected results for each case, and the list of custom artifacts covered, and make sure the quote states who executes the matrix and who signs off the results. Keep the staging hostname, proxy headers and TLS configuration identical to production, since a mismatch there can hide or create the same failures. Treat any failed case as a blocker for cutover until its cause is understood and either fixed or formally accepted by the service owner.
What makes a Keycloak upgrade take longer than expected
This table lists the factors that most often stretch a Keycloak 25 to 26 upgrade, how each one changes the work, and what to verify before scheduling. Read it as a checklist for scoping: the drivers that score high on your estate are the ones to size with your team and your vendor before you commit to a window.
| Driver | Effect on effort | What to check |
|---|---|---|
| Number of realms and clients | More realms and clients mean more configuration to review, more post-upgrade login tests and more places where client settings can drift. | Export realm and client inventories, identify clients using deprecated settings, and define a test login per client type. |
| Custom SPIs, authenticators and themes | Custom providers are compiled against the server API, so each one needs rebuilding, retesting and sometimes code changes before the target release runs. | Confirm each provider's source owner, build against the 26 line, and test authentication flows and themed pages on a staging copy. |
| User federation (LDAP, Active Directory) | Federation links, mappers and sync schedules must behave the same after upgrade, and directory timeouts or certificate changes surface late. | Test a full and a changed-user sync, verify attribute mappers, and confirm TLS trust stores and bind accounts. |
| Identity brokers (OIDC, SAML, social) | Each brokered provider has its own redirect URIs, signing certificates and claim mappings that must be retested end to end. | Check redirect URIs, signing keys and metadata for every broker, and run a sign-in through each one. |
| Database size and schema migration mode | Automatic migration at startup is simple on small databases but can extend the window on large ones, while manual migration adds a review and scripting step. | Confirm database size, take a verified backup, decide between automatic and manual migration, and rehearse the SQL on a copy. |
| High availability design | Clustered nodes need rolling restarts, a synchronously replicated database and cache behavior checked during the mixed-version period. | Document the node count, the cluster topology, session and cache handling, and the rollback sequence for each node. |
| Deployment method | The Operator with manual approval mode gives a reviewed change path, while a hand-managed install means every step, including configuration files and restarts, is written by your team. | Confirm the Operator subscription approval setting, the Keycloak custom resource version, and the scripted steps for a hand-managed install. |
| Minor releases between current and target | Each minor release can carry opt-in breaking changes and migration notes, so a larger gap means more notes to read and more settings to review. | List every intermediate release, read its upgrade notes, and record which changes apply to your configuration. |
| Monitoring and proxy configuration | Metrics, health endpoints, hostname settings and reverse proxy headers all change how a node presents itself, so gaps here are found only after cutover. | Verify metrics are scraped on the management interface, confirm hostname and proxy-header settings, and test admin console access on its separate hostname. |
What buyers ask about cost, time and the work a Keycloak upgrade needs
What drives the cost of a Keycloak 25 to 26 upgrade?
The cost follows how much of your Keycloak deployment has to be inventoried, tested and cut over. The main drivers are the number of realms, clients and identity sources (LDAP, Active Directory, brokered providers), any custom providers, themes or event listeners that must be rebuilt and retested against the 26 line, the database and clustering topology, and how many environments (development, test, staging, production) the change must pass through. Whether user sessions must survive the cutover also adds planning and test effort.
One-time costs cover discovery, the upgrade rehearsal, testing, cutover and handover. Recurring costs appear only if you buy post-upgrade support or a retainer. A written scope should list the starting and target versions, the systems and environments in scope, the deliverables (runbook, backup and rollback plan, test results), exclusions, the responsibilities of your team, and the change control path. Ask each provider to show how each line item maps to those deliverables.
How long does a Keycloak 25 to 26 upgrade take?
Duration depends on the effort drivers in your environment, so no fixed timeline applies to every deployment. The biggest factors are the volume and complexity of custom code, the size of the realm and client inventory, the number of environments that must be rehearsed before production, the depth of test coverage your team can sign off, and the change windows and approval cycles your organization requires. Waiting time for access, certificates or database snapshots often adds more elapsed time than the technical steps.
Ask for a schedule built from milestones (discovery, rehearsal, test sign-off, production cutover, post-upgrade review) with the assumptions written beside each one. Confirm the migration steps against the Keycloak upgrading guide for the versions you are moving between, and treat any date in a proposal as conditional on the inputs your team has agreed to provide.
What does our team need to provide for the upgrade?
Your team supplies access, inventory, code and decisions that the work cannot proceed without. The core list includes:
- Environment access for non-production and production, including the change windows you allow
- An export or inventory of realms, clients, identity providers, user federation settings and authentication flows
- Custom code (custom providers, themes, event listeners, and build pipelines) with its source repositories and build instructions
- Database backup and restore access, plus the current schema migration approach
- Reverse proxy, DNS and TLS configuration details for each hostname
- A named test owner who can define acceptance criteria and sign off results
- A change approval path with the people who authorize production work
Missing items usually surface late, so confirm each one in writing before the rehearsal starts.
Can an internal team upgrade Keycloak 25 to 26 without a partner?
An internal team can do the upgrade alone if it has the required skills and time for testing. The skills that matter most are Keycloak administration (realms, clients, flows, identity providers), database administration (backup, restore and migration behavior), Linux and TLS or reverse proxy configuration, and the operations platform that runs Keycloak. If the deployment includes custom providers, the team also needs Java development and build skills to rebuild and test them against the new release. Teams running the Keycloak Operator on Kubernetes need that platform experience too, including how manual approval mode changes when an update is applied.
The deciding questions are whether the team has tested a production identity upgrade before, whether it can staff a rehearsal and a rollback drill, and whether it can keep people available for the cutover window. A partner is useful when those skills or hours are missing, not as a default.
What should a quote include for backup, rollback and testing?
A useful quote lists the backup, rollback and test deliverables by name, not as general assurances. Ask for a backup procedure covering the database and configuration exports, with restore steps your team can follow. Because Keycloak migrates the database schema automatically at startup by default, ask how the rollback plan handles schema changes, including whether a database restore is the rollback path and how long that restore is expected to take in your environment.
The test matrix should name the realms, clients, identity sources, login and logout flows, token and session behavior, admin tasks and custom providers under test, along with the expected result for each. Ask for post-upgrade support with a stated period, the response process during that period, the handover documents, and the criteria for closing the engagement.
Does DeployOpen issue compliance attestations for a Keycloak upgrade?
No. DeployOpen does not issue audit reports, attestations or certifications for a Keycloak upgrade. DeployOpen prepares the systems, controls and evidence that an assessment will examine. For an upgrade, that can include documented change records, configuration exports, access and authentication settings, backup and rollback records, and test results tied to your agreed acceptance criteria. Independent auditors and certification bodies review that evidence and issue any attestation.
Before you start, confirm with your auditor which evidence they expect for changes to identity systems and how long they want it retained. Ask any implementation partner to list the evidence it will hand over so your compliance lead can check it against those expectations.
How DeployOpen scopes, delivers and supports a Keycloak upgrade
DeployOpen plans and carries out Keycloak 25 to 26 upgrades inside your own infrastructure, starting from a written scope that names your realms, clients, custom providers and hosting model. Each stage ends with documented evidence that sessions, sign-in flows and integrations behave as they did before the move.
How we scope
- Inventory your realms, clients, identity brokers, user federation links and custom providers before any change is made
- Confirm which database, hosting model and high availability design your 25 deployment uses and whether it is single-cluster or multi-site
- Agree the written scope, deliverables and timeline with you before work starts, since most engagements are fixed-scope
How we build
- Enable persistent sessions on your 25 deployment first, then confirm session continuity in a non-production environment
- Test custom providers and themes against the 26 release, and update the Protostream cache configuration and hostname v2 and proxy-header settings where they apply
- Run the schema migration in a rehearsal, either automatic at startup or applied manually, and record timings and rollback steps
How we hand over
- Deliver the updated configuration as code or documented settings, with a record of every change made to realms and clients
- Provide test evidence for login, logout, token refresh, federation sync and each integration, with pass or fail results
- Document the rollback procedure and the operational runbook so your team can repeat the upgrade for future minor releases
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the handover, if your team wants that cover
- Review each upcoming minor release's upgrade notes against your configuration before you plan the next change window
- Confirm with your team which monitoring, metrics and logging you need in place to watch the upgraded cluster after go-live

