keycloak

by HelmForge

Helm chartv3.1.1App 26.8.2Apache-2.0Verified publisher

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

ModeWhen to useDocument
devlocal testing, bootstrap validation, temporary environmentsdocs/dev.md
productionreverse-proxy deployments with an external databasedocs/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 dev and production runtime modes
  • official quay.io/keycloak/keycloak image
  • 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 HTTPRoute resources for public and admin traffic
  • optional truststore and external database TLS material
  • optional External Secrets Operator ExternalSecret resources 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, and extraContainers
  • 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 dev when you need quick startup and disposable local behavior
  • use production when 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 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 the stateless feature used by multi-cluster v2
  • Kubernetes pods expose their pod name as KC_CACHE_EMBEDDED_NODE_NAME for 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 terminationGracePeriodSeconds aligned with connection draining at the proxy layer
  • Kubernetes and OpenShift truststore initialization improved upstream; keep custom truststore and 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 using extraEnv for 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.trustedAddresses maps to KC_PROXY_TRUSTED_ADDRESSES
  • proxy.protocolEnabled maps to KC_PROXY_PROTOCOL_ENABLED and cannot be used with proxy.headers
  • management.relativePath maps to KC_HTTP_MANAGEMENT_RELATIVE_PATH and updates probes and ServiceMonitor paths
  • database.external.schema, database.external.pool.*, database.external.logSlowQueriesThreshold, and database.external.transaction.* map to Keycloak database runtime settings
  • features.enabled and features.disabled map to KC_FEATURES and KC_FEATURES_DISABLED
  • optimized.enabled adds --optimized for custom pre-built production images
  • metrics.userEvents, metrics.cacheHistograms, telemetry.*, tracing.*, and logging.* map to Keycloak observability settings
  • deployment.progressDeadlineSeconds and deployment.strategy.* control Kubernetes rollout behavior
  • serviceAccount.automountServiceAccountToken controls whether Kubernetes mounts the service account token and cluster CA files
  • truststore.kubernetes.enabled maps to KC_TRUSTSTORE_KUBERNETES_ENABLED
  • capacity.profile can render conservative small, medium, or large resource presets when resources is 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

  • production is 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: production for all real environments
  • prefer admin.existingSecret and database.external.existingSecret
  • the built-in database wait init container inherits securityContext and 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 set hostname.admin explicitly

Reverse proxy and hostname

  • always set hostname.hostname in production mode
  • set hostname.admin when the admin console should live on a separate host
  • align proxy.headers with 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 dev mode 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 resources and priorityClassName

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 > 1 and 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-ping as 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=true requires hostname.admin in production mode
  • probes.profile=heavy-startup is available for slower bootstrap profiles with heavier providers or themes

Main values

ParameterDescriptionDefault
modedev or productiondev
image.repositoryKeycloak image repositoryquay.io/keycloak/keycloak
image.tagKeycloak image tag26.8.2
admin.existingSecretExisting secret for bootstrap admin credentials""
http.portApplication HTTP port8080
http.managementPortManagement port for health and metrics9000
http.relativePathRelative HTTP path/
management.relativePathOptional management relative path""
deployment.progressDeadlineSecondsDeployment progress deadline for startup and migrations600
deployment.strategy.typeDeployment strategyRollingUpdate
deployment.strategy.rollingUpdate.maxUnavailableMax unavailable pods during rollout0
deployment.strategy.rollingUpdate.maxSurgeMax surge pods during rollout1
hostname.hostnamePublic hostname or URL""
hostname.adminDedicated admin hostname or URL""
proxy.headersProxy headers modexforwarded
proxy.trustedAddressesTrusted proxy IPs/CIDRs""
proxy.protocolEnabledEnable HAProxy PROXY protocolfalse
database.mysqlSchemaInitializedConfirm the schema exists before running multiple replicas with bundled or external MySQLfalse
database.external.vendorExternal database vendorpostgres
database.external.hostExternal database host""
database.external.nameExternal database namekeycloak
`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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkeycloak is pinned at v3.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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