The servers were silent until the first user logged in. Then the load spiked, tokens moved, and every request depended on Keycloak holding the line. In a production environment, there’s no margin for error.
Deploying Keycloak for production means more than running a Docker container. You need hardened security, high availability, tuned performance, and clear operational visibility. Without this, outages and breaches are only a matter of time.
Start with architecture. Always run at least two Keycloak nodes behind a load balancer. Use sticky sessions or, better, a shared database and Infinispan in replicated or distributed mode. Choose a database that matches your scalability plan—PostgreSQL and MariaDB are common, but tune connection pools and indexes before launch.
Security is next. Enforce TLS everywhere. Use strong cipher suites and disable legacy protocols. Configure admin console access over a VPN or isolated network. Audit every realm for unnecessary clients, roles, and mappers. Rotate secrets and keys on a defined schedule.