keycloak
by HelmForge
Keycloak for Kubernetes with explicit dev and production modes
About this chart
Keycloak
Keycloak for Kubernetes with explicit dev and production modes, external database modeling for real deployments, and a clear separation between public traffic and the management interface.
Install
HTTPS repository
helm repo add helmforge https://repo.helmforge.dev
helm repo update
helm install keycloak helmforge/keycloak -f values.yaml
OCI registry
helm install keycloak oci://ghcr.io/helmforgedev/helm/keycloak -f values.yaml
Supported modes
| Mode | When to use | Document |
|---|---|---|
dev | local testing, bootstrap validation, temporary environments | docs/dev.md |
production | reverse-proxy deployments with an external database | docs/production.md |
Architecture guides
- Production Mode
- Reverse Proxy and Hostname
- Scaling and Clustering
- Security and Trust
- Extensions and Themes
- Backup and Restore
- Scope and Automation Boundaries
- Production Capacity
What this chart covers
- explicit
devandproductionruntime modes - official
quay.io/keycloak/keycloakimage - bootstrap admin credentials through generated secret or
existingSecret - external database as the production path
- explicit hostname and proxy configuration
- separate management service for health and metrics
- optional realm import through
/opt/keycloak/data/import - optional provider and theme mounts
- optional separate ingresses for public and admin traffic
- optional Gateway API
HTTPRouteresources for public and admin traffic - optional truststore and external database TLS material
- optional External Secrets Operator
ExternalSecretresources for clusters that already run the operator - optional IPv4/IPv6 dual-stack Service fields
- optional database-aware S3 backup CronJob for PostgreSQL/MySQL-backed modes
- controlled extension hooks through
extraEnvFrom,initContainers, andextraContainers - optional
ServiceMonitor - first-class production options for trusted proxies, management relative path, database pool/schema/timeouts, features, logging, telemetry, and tracing
- rollout strategy, service account token mounting, capacity profiles, and optional egress NetworkPolicy controls
How to choose the mode
- use
devwhen you need quick startup and disposable local behavior - use
productionwhen you need external URLs, reverse proxy correctness, and an external database
Recommended reading before installation:
- Dev Mode
- Production Mode
- Reverse Proxy and Hostname
- Scaling and Clustering
- Security and Trust
- Extensions and Themes
- Backup and Restore
- Scope and Automation Boundaries
- Production Capacity
Official product references
- Keycloak downloads
- Keycloak release notes
- Keycloak production configuration
- Keycloak hostname configuration
- Keycloak caching and transport stacks
- Keycloak general configuration
- Keycloak all configuration
- Kubernetes Gateway API
- External Secrets Operator
Keycloak 26.8.x alignment
This chart tracks the official Keycloak server image quay.io/keycloak/keycloak:26.8.2.
Relevant 26.8.x operational changes to account for during rollout:
- 26.8.2 supersedes 26.8.1 and includes security fixes; review the upstream migration guide before production rollout
- multi-cluster v1 (
multi-site) is deprecated in favor of thestatelessfeature used by multi-cluster v2 - Kubernetes pods expose their pod name as
KC_CACHE_EMBEDDED_NODE_NAMEfor stable cache-node observability - large-table indexes skipped during schema migration can now be created automatically in the background on supported databases
- zero-downtime patch releases are supported within the same minor stream, but still require readiness, proxy, and database validation
- the HTTP stack supports graceful shutdown, so keep
terminationGracePeriodSecondsaligned with connection draining at the proxy layer - Kubernetes and OpenShift truststore initialization improved upstream; keep custom
truststoreand database CA mounts explicit when the platform uses private CAs - database operations and timeout behavior changed in the 26.6 stream; validate startup, migration, and failover logs before widening traffic
KCRAW_is available upstream for preserving literal environment values; continue usingextraEnvfor advanced options that are not first-class chart values yet
Phase 3 production controls
This chart exposes common Keycloak production options as first-class values:
proxy.trustedAddressesmaps toKC_PROXY_TRUSTED_ADDRESSESproxy.protocolEnabledmaps toKC_PROXY_PROTOCOL_ENABLEDand cannot be used withproxy.headersmanagement.relativePathmaps toKC_HTTP_MANAGEMENT_RELATIVE_PATHand updates probes and ServiceMonitor pathsdatabase.external.schema,database.external.pool.*,database.external.logSlowQueriesThreshold, anddatabase.external.transaction.*map to Keycloak database runtime settingsfeatures.enabledandfeatures.disabledmap toKC_FEATURESandKC_FEATURES_DISABLEDoptimized.enabledadds--optimizedfor custom pre-built production imagesmetrics.userEvents,metrics.cacheHistograms,telemetry.*,tracing.*, andlogging.*map to Keycloak observability settingsdeployment.progressDeadlineSecondsanddeployment.strategy.*control Kubernetes rollout behaviorserviceAccount.automountServiceAccountTokencontrols whether Kubernetes mounts the service account token and cluster CA filestruststore.kubernetes.enabledmaps toKC_TRUSTSTORE_KUBERNETES_ENABLEDcapacity.profilecan render conservativesmall,medium, orlargeresource presets whenresourcesis not set
Gateway API support is optional and renders only HTTPRoute resources. The chart does not create GatewayClass or Gateway resources.
External Secrets support is optional and intended only for clusters that already have External Secrets Operator and a
SecretStore or ClusterSecretStore. The chart renders ExternalSecret resources that materialize the Kubernetes
Secrets consumed by the existing admin, database, and truststore paths; it does not install the operator or create
provider stores.
Operational direction
productionis the normal path for real environments- production expects a reverse proxy or ingress in front of Keycloak
- the management interface is kept separate and must not be exposed through the public or admin ingress
- multi-replica runtime is supported, but it must be treated as a cache/discovery concern and not just a Deployment scaling flag
Quick start
Minimal local example:
mode: dev
Production with external database:
mode: production
hostname:
hostname: https://sso.example.com
database:
external:
vendor: postgres
host: postgresql-rw.default.svc
name: keycloak
username: keycloak
existingSecret: keycloak-db
Production with PostgreSQL subchart:
mode: production
hostname:
hostname: https://sso.example.com
postgresql:
enabled: true
auth:
database: keycloak
username: keycloak
password: change-me
Dev with PostgreSQL subchart:
mode: dev
postgresql:
enabled: true
auth:
database: keycloak
username: keycloak
password: devpassword
Best practices
Security
- use
mode: productionfor all real environments - prefer
admin.existingSecretanddatabase.external.existingSecret - the built-in database wait init container inherits
securityContextand is non-root with dropped capabilities by default - keep the management service internal
- restrict admin exposure at the reverse proxy layer when using a dedicated admin hostname
- use Security and Trust when database TLS or custom internal CAs are involved
- if
ingress.admin.enabled=true, always sethostname.adminexplicitly
Reverse proxy and hostname
- always set
hostname.hostnamein production mode - set
hostname.adminwhen the admin console should live on a separate host - align
proxy.headerswith your ingress or reverse proxy behavior - use the public ingress for user-facing traffic and a separate admin ingress when the admin console should sit behind a different ingress class or internal load balancer
- review Reverse Proxy and Hostname before exposing the chart publicly
Database and runtime
- treat the external database as part of the critical-path design
- prefer PostgreSQL for production examples and guidance
- enable built-in backup only when the release uses PostgreSQL, MySQL, or MariaDB instead of embedded H2
- do not use
devmode as a hidden production shortcut - review Scaling and Clustering before raising
replicaCount - review Scope and Automation Boundaries before asking the chart to solve autoscaling or operator-style concerns
- review Production Capacity before choosing explicit
resourcesandpriorityClassName
Realm import and extensions
- use realm import for bootstrap and lower-environment seeding
- do not treat startup import as a full reconciliation control plane
- mount providers and themes explicitly so restart behavior stays predictable
- review Extensions and Themes before adding providers, themes, or sidecars
Production notes
- production mode fails fast when hostname or database configuration is missing
- management health and metrics stay on the management service
- public and admin ingresses both route only to the application service
- the admin ingress exists to separate exposure policy, hostname, and ingress class from the public ingress
- if
replicaCount > 1, keep cache and cluster expectations explicit in the deployment plan - if
replicaCount > 1and no custom scheduling is set, the chart applies soft pod anti-affinity and topology spread defaults - prefer separate public and admin hostnames when the admin console needs tighter exposure rules
- keep sticky-session behavior aligned with the ingress controller in front of Keycloak
- treat
jdbc-pingas discovery and cache transport plumbing, not as a substitute for a Keycloak operator - plan image rollouts and rollbacks together with the external database and reverse-proxy layer
- Helm upgrades with live cluster access preserve chart-generated admin and database passwords through
lookup - offline and GitOps renderers cannot preserve generated passwords through
lookup; set explicit password values, use existing Secrets, or enable External Secrets instead of leaving passwords empty - the runtime Secret checksum covers explicit chart-managed payload values; externally managed Secret changes still require an explicit rollout or restart
- built-in backup targets the selected Keycloak database and uploads the compressed dump to S3-compatible storage
- externally managed truststore changes still require an explicit rollout or restart
- provider and theme source changes can be rolled forward predictably with
rolloutToken - HPA remains intentionally out of scope as a built-in feature for the current chart scope
ingress.admin.enabled=truerequireshostname.adminin production modeprobes.profile=heavy-startupis available for slower bootstrap profiles with heavier providers or themes
Main values
| Parameter | Description | Default |
|---|---|---|
mode | dev or production | dev |
image.repository | Keycloak image repository | quay.io/keycloak/keycloak |
image.tag | Keycloak image tag | 26.8.2 |
admin.existingSecret | Existing secret for bootstrap admin credentials | "" |
http.port | Application HTTP port | 8080 |
http.managementPort | Management port for health and metrics | 9000 |
http.relativePath | Relative HTTP path | / |
management.relativePath | Optional management relative path | "" |
deployment.progressDeadlineSeconds | Deployment progress deadline for startup and migrations | 600 |
deployment.strategy.type | Deployment strategy | RollingUpdate |
deployment.strategy.rollingUpdate.maxUnavailable | Max unavailable pods during rollout | 0 |
deployment.strategy.rollingUpdate.maxSurge | Max surge pods during rollout | 1 |
hostname.hostname | Public hostname or URL | "" |
hostname.admin | Dedicated admin hostname or URL | "" |
proxy.headers | Proxy headers mode | xforwarded |
proxy.trustedAddresses | Trusted proxy IPs/CIDRs | "" |
proxy.protocolEnabled | Enable HAProxy PROXY protocol | false |
database.mysqlSchemaInitialized | Confirm the schema exists before running multiple replicas with bundled or external MySQL | false |
database.external.vendor | External database vendor | postgres |
database.external.host | External database host | "" |
database.external.name | External database name | keycloak |
| `database.external. |
Deploy keycloak with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has keycloak on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartkeycloak is pinned at v3.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply