Can Keycloak run self-hosted and on premise, and what does it take?
Yes, Keycloak is built to run self-hosted and on premise. The community project is open source under Apache 2.0, and the project ships it as a server distribution, a container image and an operator, so a platform or security team can keep identity inside its own network. If you need a distribution that Red Hat supports on a subscription basis, the Red Hat build of Keycloak is the option to evaluate, and it is covered on its own page. Either way, you own the servers, the database, the certificates, the upgrades and the on-call rotation.
The work starts with a Java runtime. The ZIP distribution asks for OpenJDK 25, and you must choose a supported external database from the project's list, since the bundled development database is for trials only. Production mode (start) disables plain HTTP, expects a hostname and needs TLS on every connection, so the server will not start until you supply certificates and hostname settings. Plan a reverse proxy with path restrictions, and put the admin console and Administration REST API on a separate hostname or context path from public frontend URLs. Pick one of the documented high availability designs early, because both supported multi-site designs depend on a synchronously replicated database, and that choice shapes your network and database topology.
Air-gapped operation needs its own check. The project's published material does not, on the sources we rely on here, settle how an offline install, image mirror or update path works inside a restricted network. Confirm with the project or Red Hat how you would obtain artifacts, container images and operator bundles, and how you would apply security fixes, before you commit to an architecture. Then assign owners for patching, backups, metrics at /metrics when --metrics-enabled=true is set, and the upgrade cadence the project now runs, since the operations work continues long after the first install.
Self-hosting capabilities by distribution
This table compares what the community Keycloak project and the Red Hat build of Keycloak provide for self-hosted installs, covering install methods, databases, operating systems, OpenShift versions, high availability and release cadence. Each cell starts with a label: built in, paid subscription, outside component or not stated. Where a cell says not stated, confirm the detail with Red Hat or in your own test before you choose a platform.
| Capability | Community Keycloak | Red Hat build of Keycloak |
|---|---|---|
| Install methods | Built in: ZIP or TAR.GZ server, Quay container image, OperatorHub operator | Not stated: confirm the artifacts and packaging for build 26.6 with Red Hat |
| Supported databases | Built in: PostgreSQL 14 to 18, MariaDB, MySQL, SQL Server, Oracle, Aurora PostgreSQL, Azure SQL, EnterpriseDB | Not stated: confirm the database list for build 26.6 before sizing the database tier |
| Supported operating systems | Not stated: confirm the OS list for your Java runtime and container host | Paid subscription: RHEL 8, 9 and 10; Windows Server 2019 and 2022 for build 26.6 |
| OpenShift versions | Outside component: OpenShift runs the image or operator, so check its version list separately | Paid subscription: OpenShift 4.12 to 4.22 for build 26.6 |
| High availability architectures | Built in: single cluster, optionally across availability zones, and multi-cluster v2; both need synchronous database replication | Not stated: confirm which high availability designs the Red Hat build supports |
| Operator install path | Built in: Operator via Operator Lifecycle Manager (recommended), kubectl or an experimental Helm chart | Not stated: confirm operator channel and update approval settings for the Red Hat build |
| Release cadence | Built in: four minor releases a year and a major release every two to three years | Not stated: confirm the build's release schedule and support window with Red Hat |
How the self-hosted Keycloak stack fits together
A self-hosted Keycloak is a set of components you operate, and each one needs an owner before the build starts. The Keycloak server handles protocol traffic and the admin console. It keeps its persistent state in an external database, which is not a bundled store you can treat as disposable. In the high availability designs the project documents, that database must be synchronously replicated, because realm and session state written on one node has to be visible to the others immediately. The database choice also sets your backup, failover and patching windows, so decide it alongside the server, not after it.
In front of the servers sits a reverse proxy that terminates TLS and restricts paths. The production guidance expects TLS on all communication, and it asks you to serve the admin console and the Administration REST API on a different hostname or context path from the public frontend URLs. That split is a design decision: your DNS names, certificates, proxy rules and firewall policy all have to reflect two audiences. Keep the management interface, where the metrics endpoint lives when --metrics-enabled=true is set, reachable only from your monitoring network. Confirm that your proxy, load balancer and ingress each pass the forwarded headers Keycloak needs to build correct URLs.
The cache and clustering layer holds realm data and sessions across nodes, so node count, cache topology and the sizing inputs you choose all interact. Enforcement happens at startup. Production mode (start) refuses to run without a configured hostname and an HTTPS setup, so a missing certificate is a failed deployment rather than a silent insecure one. Schema migration also runs at startup by default. Decide whether your change process accepts that automatic migration or whether a database administrator applies the SQL manually, which the upgrade guidance suggests for large deployments. Write that decision into your runbook before the first production start.
Decisions to make before you install Keycloak on your own infrastructure
Running Keycloak yourself means settling six choices before the first install: how you get the software, which database holds your realms, how the cluster survives a zone failure, how traffic reaches it, how much capacity you provision, and how upgrades move the schema. Each choice shifts who on your team carries the work, how fast you recover from a failure, and what evidence you can show an auditor.
Choose the distribution
Keycloak ships as a ZIP or TAR.GZ server distribution, a container image on Quay, and an operator on OperatorHub. The ZIP route means your team owns the Java runtime, service units and patching. The operator route moves lifecycle work into Kubernetes, where set the operator to manual approval mode so a new release never rolls out unreviewed. Confirm which method your change process can evidence.
Keycloak downloadsPick a supported production database
Keycloak supports MariaDB, Microsoft SQL Server, MySQL, Oracle Database, PostgreSQL (14 to 18), EnterpriseDB Advanced, Amazon Aurora PostgreSQL and Azure SQL. The bundled dev-file database is for development only. Your database choice decides who is paged during an outage, which backup tooling you need, and whether your DBA team already has tested restore procedures for it.
Database guideSelect the high availability architecture
Keycloak documents a single cluster optionally spread across availability zones, multi-cluster v2 without external Infinispan, and the deprecated multi-cluster v1. Both supported designs depend on a synchronously replicated database, so that database's replication setup determines your recovery time more than the Keycloak nodes do. Confirm the latency between sites before you commit to a design.
High availability overviewSeparate admin and public hostnames
The production guide calls for TLS on every connection, a reverse proxy with path restrictions, and an admin console and Administration REST API on a different hostname or context path from public frontend URLs. Decide these hostnames before go-live, because changing them later affects redirect URIs, client configuration and certificates. Restricting admin access at the proxy is also audit evidence for access control reviews.
Production configurationSize for logins and token traffic
The sizing guide uses a base of 1250 MB of RAM per Pod, including realm caches and 10,000 cached sessions. It allocates 1 vCPU for each 15 password-based logins per second and each 120 client credential or refresh token requests per second, plus 150% CPU headroom for spikes. Ask your team to measure real login and token rates first, since these inputs drive node count, cost and cluster capacity.
Sizing conceptsPlan automatic or manual schema migration
Keycloak migrates its database schema at startup by default. For large deployments, the upgrading guide suggests applying the SQL manually, which gives your DBA team a reviewed script and a rollback point. Automatic migration shortens each upgrade but raises risk during a change window. Document which path you chose, because the change record is evidence you will need during a review.
Upgrading guideHow self-hosting changes by environment
On virtual machines, Keycloak runs from the ZIP or TAR.GZ server distribution that the project publishes on its downloads page, under a service definition your team writes and operates. Red Hat's supported configurations article lists Red Hat Enterprise Linux 10, 9 and 8 for Red Hat build of Keycloak 26.6, so a RHEL-based image has the clearest tested path. Your team owns everything around the binary.
- Operating system: Choose RHEL 10, 9 or 8 if you want the Red Hat build on a listed platform, and record the exact minor release in your build standard.
- Java runtime: Install OpenJDK 25 on every node, as the getting started guide for the ZIP distribution asks, and pin the patch level under change control.
- Service definition: Run Keycloak as a non-root account with a unit file that starts the server in production mode (
start), which disables HTTP and will not start until a hostname and TLS are configured. - Proxy and hostnames: Place a reverse proxy in front of each node for TLS termination and path restrictions, and serve the admin console on a separate hostname from public frontend URLs.
- Sizing and patching: Start from the sizing guide's base memory figure of 1250 MB, apply its CPU formula, and schedule patch windows for the OS, JDK and Keycloak separately.
Confirm with Red Hat which RHEL minor releases and JDK builds the support article covers before you freeze the image.
On Kubernetes or OpenShift, the Keycloak Operator is the recommended way to manage the server, and the operator installation guide covers installation through Operator Lifecycle Manager, with kubectl or with an experimental Helm chart. The Operator manages the Keycloak, KeycloakRealmImport, KeycloakOIDCClient and KeycloakSAMLClient custom resources. Red Hat's supported configurations list OpenShift 4.12 to 4.22 for Red Hat build of Keycloak 26.6.
- Cluster version: Confirm your OpenShift release falls within 4.12 to 4.22, and plan a move if your cluster is outside that range before go-live.
- Update control: Set operator updates to manual approval, which the Operator documentation strongly recommends to avoid unintended upgrades.
- External dependencies: Provide a supported database, ingress with TLS, and secrets management, since the Operator does not supply them.
- Schema changes: Decide whether the database migrates at startup (the default) or whether your DBAs apply the SQL by hand, which the upgrading guide suggests for large deployments.
- Observability: Enable metrics with
--metrics-enabled=trueand connect them to your monitoring stack.
Confirm with your Red Hat account team which operator channel and bundle version your subscription covers before you mirror it into your cluster.
On Windows Server, the supported path for Red Hat build of Keycloak 26.6 is narrower than on Linux. Red Hat's supported configurations article lists Windows Server 2022 and 2019 for that version. Windows Server 2025 does not appear in that list, so confirm it with Red Hat before you select it for a new build. The project's ZIP distribution is the install method your team would use, and the same production-mode rules apply.
- Supported versions: Standardize on Windows Server 2022 or 2019 and record the cumulative update level you tested.
- Java runtime: Install OpenJDK 25 system-wide, set
JAVA_HOMEfor the service account, and verify the version after every JDK patch. - Service wrapper: Choose and support a Windows service wrapper yourself, including restart behavior, dependency order and recovery actions.
- File permissions and logs: Lock down the install directory and configuration files, and set log rotation so the disk does not fill during an incident.
- Database and proxy: Connect to a supported database over TLS and place a reverse proxy in front, since production mode expects HTTPS.
Confirm whether your Red Hat subscription covers Windows deployments for the exact product version you plan to run, and whether your database vendor supports the Windows client stack you intend to use.
In a restricted or air-gapped network, Keycloak cannot pull its JDK, container images or operator bundle from the internet at install time or during upgrades. Every artifact has to be brought in through an approved transfer process and stored in internal repositories. The production configuration guide also assumes TLS on all communication, so certificate trust must be designed before the first node starts.
- Offline media: Transfer the OpenJDK 25 installer, the ZIP or TAR.GZ distribution, and the database driver into your controlled repository with checksums recorded.
- Container and operator mirroring: Mirror the Quay container image and the OperatorHub bundle into an internal registry, and keep the exact tags you tested.
- Time synchronization: Run NTP or an equivalent internal time source on every node, because token validity and certificate checks depend on accurate clocks.
- Certificates: Issue TLS certificates from your internal certificate authority, distribute the trust chain to the JDK truststore, and set a renewal process.
- Upgrade path: Plan how new releases enter the network through the same transfer process, including the security review each drop needs.
Confirm with Red Hat whether a disconnected environment can receive subscription content for the Red Hat build, and how your transfer approvals handle each artifact type.
Order of work for a production self-hosted Keycloak
This sequence takes a self-hosted Keycloak from a platform decision to a tested, recoverable service, with a check that closes each step so problems surface before users depend on the system.
Confirm the platform and OS matrix
Start by confirming which operating systems, container platforms and Keycloak version your organization will run, and whether you will use the community project or the Red Hat build. Check the Red Hat supported configurations article for the Red Hat build's operating systems and OpenShift versions, and confirm your chosen distribution against the current release notes. Your platform team and DeployOpen (if engaged) should sign off on this matrix in writing. Done when every component in the target environment appears on a supported list, or each gap has a documented exception approved by the owner.
Prepare the JDK and database
Install the Java runtime that the chosen Keycloak release requires. The ZIP distribution's getting started guide asks for OpenJDK 25, so confirm that version against your release before installing. Provision one of the supported production databases, such as PostgreSQL within the supported version range, and create a dedicated database and account with only the privileges Keycloak needs. Do not use the development file database. Done when Keycloak starts against the database in a non-production environment and the schema migration completes without errors.
Build the production configuration with TLS and hostname
Switch from development mode to production mode, which disables plain HTTP and requires a configured hostname and TLS. Issue certificates from your internal or public CA, configure the reverse proxy, and separate the admin console and Administration REST API onto a different hostname or context path from public frontend URLs, with path restrictions at the proxy. Store secrets outside the configuration files. Done when the server starts in production mode, public endpoints load over HTTPS, and the admin endpoints are unreachable from the public path.
Design the HA topology and test failover
Choose one of the high availability architectures the project documents: a single cluster, optionally spread across availability zones, or a multi-cluster design. Both supported designs require a synchronously replicated database, so confirm that your database platform provides this before committing. Run a failover test by stopping a node and then the database primary under load, and record login and token behavior during each event. Done when sessions survive a single node loss and the team has a written recovery procedure for each failure you tested.
Configure metrics and logs
Enable the metrics endpoint with the metrics option set to true, and confirm that Prometheus can scrape the management interface without exposing it to public networks. Decide whether to enable the optional HTTP request and cache histograms, which add detail and load. Route server logs to your central logging platform and set alerts on health and login failure trends. Done when a scrape returns the expected series from a test node, and an alert fires when a test failure is introduced.
Set the upgrade policy
Set the operator to manual approval mode so that updates do not apply automatically, which the Keycloak Operator documentation strongly recommends. For large deployments, plan to apply database schema changes manually with the SQL the upgrade guide provides, instead of letting the server migrate at startup. Review the upgrade notes for the target version before each change, including the changes listed for the 26.8 line, such as enforced SMTP StartTLS and backchannel logout token validation. Done when a written policy names who approves each upgrade, who applies the schema changes and where the release notes are reviewed.
Run a restore and upgrade rehearsal
Restore the database and configuration from backup into an isolated environment, start the cluster and confirm that a test realm, client and user still authenticate. Then perform an upgrade on that copy using the approved policy, including the manual migration path if you use it, and repeat the login checks. Record the elapsed steps and any manual interventions. Done when the restore reproduces a working realm, the upgrade completes without data loss, and the runbook reflects the actual steps taken before the service goes live.
What a security reviewer asks to see for a self-hosted Keycloak
This table lists the evidence a security reviewer typically requests for a self-hosted Keycloak and where each item can be read on the platform. Use it to gather proof before the review starts, not to reconstruct it during the review. Each row names the place the evidence should come from, so the answer can be checked rather than taken on trust.
| Evidence | What to check | Where to read it |
|---|---|---|
| Installed version and release date | Running version matches the release you chose and is on a line the project still patches | Admin console server info page, startup log line, or the operator Keycloak resource status |
| JDK version | Runtime Java version matches the OpenJDK version the chosen Keycloak release documents | Server startup log, the java -version output on the host, or the container image tag |
| TLS and hostname settings | Production mode is active, HTTP is disabled, the hostname is fixed, and TLS covers all traffic | Configuration file or environment variables such as hostname and TLS keystore keys, plus the reverse proxy config |
| Database engine and version | Engine and version appear on the supported production list, and the dev-file database is not in use | Keycloak database configuration keys, then the database server version query run by your DBA |
| HA architecture and synchronous replication | The chosen architecture is one the project documents, and the database replicates synchronously across the sites involved | Cluster topology in the deployment design, database replication settings, and failover test records |
| Admin endpoint separation | Admin console and Administration REST API sit on a different hostname or path from public frontend URLs, and the reverse proxy blocks them externally | Reverse proxy route rules, DNS records, and a test request from outside the admin network |
| Metrics endpoint enablement | Metrics are enabled only on the management interface and are not reachable from public networks | Startup configuration for the metrics flag, then a request to the management port from the scrape network and from outside |
| Patch cadence and update control | A written schedule covers minor and patch releases, operator updates use manual approval, and each change has a rollback plan | Change records, operator subscription approval settings, and the upgrade log kept with the platform owner |
Questions buyers ask before approving self-hosted Keycloak
Does self-hosting Keycloak cost money in software licenses?
The open source project carries no license fee to self-host. Keycloak is licensed under Apache 2.0, so you can run and modify it inside your own infrastructure. The Red Hat build of Keycloak is a separate subscription distribution, and its price is covered on the Keycloak pricing page. Your real costs are the infrastructure you run it on, the database engine and its licensing if you choose a commercial one, monitoring, and the staff time that upgrades and operations require. Infrastructure and staff are recurring costs. Planning, installation, integration and hardening are usually one-time work. When you request a quote from any partner, ask for one-time and recurring items to be listed separately, with the work each line covers.
How much effort do the install and high availability design take?
The install is usually the smaller part of the effort. The high availability design, the database and the production configuration drive most of the work. Keycloak documents three high availability architectures: a single cluster optionally spread across availability zones, multi-cluster deployments (v2) without an external Infinispan cluster, and the deprecated multi-cluster v1 design. Both supported designs need a synchronously replicated database, so database planning often sets the schedule. Production mode also changes the work: it disables HTTP, expects a hostname and requires HTTPS/TLS. Other drivers include the reverse proxy and path restrictions, sizing for your login and token volume, metrics, and whether you deploy on virtual machines, containers or the operator. Ask for effort tied to a written scope.
Can our team run Keycloak without outside help?
Many teams can run Keycloak in-house if they already operate Java services, relational databases, TLS certificates and identity protocols. The distribution choices are simple: a ZIP or TAR.GZ server, a container image, or the operator. The harder parts take experience. Sizing depends on your login and token rates, and each Keycloak release changes behavior in ways your team must check. For example, the 26.8 upgrade notes enforce SMTP StartTLS without plaintext fallback, require signature validation of backchannel logout tokens from external providers, and recommend moving from the deprecated multi-site feature to the stateless feature. Outside help usually fits a design review, a first install against a written scope, or recurring upgrades and testing under a retainer. DeployOpen plans, implements, hardens, backs up, upgrades, documents and supports Keycloak inside your infrastructure.
What does our side need to provide for a self-hosted install?
Your team supplies the network, certificates, database and people, and each has a clear owner. Confirm each item before the build starts.
- Network: DNS names for the public frontend and a separate hostname or context path for the admin console and Administration REST API, a load balancer or reverse proxy with path restrictions, and firewall rules between tiers.
- Certificates: TLS on all communication, because production mode requires HTTPS. Confirm your certificate authority process and renewal ownership.
- Database: one of the supported engines, such as PostgreSQL 14 to 18, with synchronous replication if you run high availability. Confirm the database team's backup and restore procedures.
- Compute: plan memory per pod from the base figure of 1250 MB, plus CPU sized for your peak login and token rates with 150% headroom.
- People: named owners for identity, platform, database and security, with an on-call path.
Can Keycloak run air-gapped, and what must be staged offline?
Keycloak can run in a restricted network, but staging is the work that decides it. The supplied information does not include a full offline install procedure, so confirm the steps for your chosen method with the project documentation and any partner you engage. Plan to stage the server distribution or container image in your internal registry, the operator bundle if you use OperatorHub, and OpenJDK 25 for the ZIP install. Also stage your database engine and drivers, operating system packages and any tooling your pipeline needs. Decide which external services stay reachable, such as SMTP relays, upstream identity providers and social login providers, and which move to internal equivalents. Ask for a written staging inventory with versions and checksums before the install begins.
Which operating systems and OpenShift versions does Red Hat test?
For the Red Hat build of Keycloak 26.6, Red Hat's supported configurations article lists Red Hat Enterprise Linux 10, 9 and 8 and Windows Server 2022 and 2019 as supported operating systems. The same article lists OpenShift 4.12 to 4.22. This list applies to the Red Hat build, so check it against the version you plan to run before procurement. The community project publishes its own installation guidance, and its supported platforms may differ from Red Hat's test matrix. Confirm that your operating system and OpenJDK version are available in your environment, and check that your database engine matches the list the project supports. Record the exact versions you test in staging, since platform support changes between releases.
How do upgrades affect uptime for a self-hosted Keycloak?
Uptime during an upgrade depends on your architecture, your schema migration method and how carefully you test each release. Keycloak migrates its database schema automatically at startup by default, and it also supports manual migration, which the upgrading guide suggests for large deployments. Since Keycloak 26.0, the project plans four minor releases a year and a major release every two to three years, and says breaking changes in a minor release will be opt-in. The Keycloak Operator documentation strongly recommends manual approval mode for operator updates, so upgrades do not start without a decision. Plan a staging upgrade against your own configuration, read the upgrading guide and the release notes for each version you cross, and confirm with your team whether your deployment supports rolling updates.
Where to confirm the current requirements
Confirm the current Keycloak version, JDK and operating system list on the day you approve the design, not the day you first read about them. Start with the Keycloak downloads page, which lists the server distribution, the container image and the operator, and check that the version you plan to install is the one the project currently supports. The getting started guide for the ZIP distribution names the OpenJDK release to install, and that requirement can change between releases, so record the exact JDK version in your design document alongside the Keycloak version.
Next, read the production configuration guide before you size anything. It sets out the rules that separate a test instance from a production one: production mode (start) disables HTTP, expects a hostname, and needs HTTPS/TLS configured before it will start. Then confirm your database choice against the Keycloak database guide, which lists the supported engines and the PostgreSQL versions covered. Ask your database team to confirm that their platform and version appear on that list, and to confirm the synchronous replication behavior that the high availability architectures require.
Finally, check the sizing guide for concepts for sizing CPU and memory resources against your expected login and token volumes, and check the Red Hat build of Keycloak supported configurations article if you need vendor-backed operating system and OpenShift support. Treat the sizing figures as starting points that you validate with load tests. Re-check every source at go-live and again before each upgrade, because the project ships several minor releases a year and the supported platform lists change with them.
Self-hosted Keycloak request and data path: where traffic lands and what gets monitored
The diagram starts with users and applications reaching a reverse proxy that terminates TLS. Public frontend traffic goes to the Keycloak cluster on one hostname, while the admin console and Administration REST API sit behind a separate hostname or context path that the proxy restricts. Every Keycloak node reads and writes one synchronously replicated database, which both supported high availability designs require. Metrics are exposed on the management interface and scraped by the team's monitoring. Check that admin paths are not reachable from the public side and that the database replication mode matches the chosen architecture.
Traffic enters through a TLS reverse proxy, reaches Keycloak nodes, and stores state in one replicated database.
How DeployOpen runs Keycloak in your infrastructure
DeployOpen plans, installs, hardens, documents and supports self-hosted Keycloak inside your own cloud accounts, data centers or air-gapped networks. We start from what running it yourself requires: Java and production-mode settings, the database, the high availability design and the sizing your login volume demands.
How we scope
- Written scope fixes the distribution (ZIP, container image, or Operator), the target platform and the supported database before work starts.
- Sizing inputs such as peak password logins, client credential and refresh token rates, and session counts are agreed in writing.
- Engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as a retainer.
How we build
- We configure production mode with TLS, a stated hostname and a reverse proxy that separates the admin console from public frontend URLs.
- We build the high availability design around a synchronously replicated database, with the cluster topology chosen from the architectures Keycloak documents.
- We wire metrics, logging, backups and the Operator update approval mode into the build, then test failover and upgrade steps before handover.
How we hand over
- Deliverables include the as-built configuration, network and TLS diagrams, sizing worksheet and the runbook for routine and emergency tasks.
- Your team receives documented procedures for database schema migration, rollback and admin recovery, tested in your environment.
- Handover sessions walk your operators through health checks, monitoring dashboards and the upgrade checklist for each Keycloak release.
How we support
- Support covers patching, upgrade planning and rolling updates for new Keycloak minor releases, with breaking changes reviewed before rollout.
- Security testing of applications and APIs can be scheduled against the deployed Keycloak, with findings tracked to remediation.
- Confirm with us in writing which Red Hat build or community release line, and which support terms, your scope will cover before go-live.

