keycloak

by codecentric

Helm chartv18.10.0App 17.0.1-legacyVerified publisher

Open Source Identity and Access Management For Modern Applications and Services

About this chart

Keycloak

Keycloak is an open source identity and access management for modern applications and services.

TL;DR;

$ helm install keycloak codecentric/keycloak

or via GitHub Container Registry:

$ helm install keycloak oci://ghcr.io/codecentric/helm-charts/keycloak --version <version>

Introduction

This chart bootstraps a Keycloak StatefulSet on a Kubernetes cluster using the Helm package manager. It provisions a fully featured Keycloak installation. For more information on Keycloak and its capabilities, see its documentation.

Prerequisites Details

The chart has an optional dependency on the PostgreSQL chart. By default, the PostgreSQL chart requires PV support on underlying infrastructure (may be disabled).

Important Since Version v16.0.0 the support for Helm v2 is dropped in favor of to support also the latest postgres Helm Chart Version which requires Helm v3 only.

Installing the Chart

To install the chart with the release name keycloak:

$ helm install keycloak codecentric/keycloak

Uninstalling the Chart

To uninstall the keycloak deployment:

$ helm uninstall keycloak

Configuration

The following table lists the configurable parameters of the Keycloak chart and their default values.

ParameterDescriptionDefault
fullnameOverrideOptionally override the fully qualified name""
nameOverrideOptionally override the name""
replicasThe number of replicas to create1
image.repositoryThe Keycloak image repositoryquay.io/keycloak/keycloak
image.tagOverrides the Keycloak image tag whose default is the chart version. Note versions after 16.1.1 need to use the -legacy suffix, e.g. 17.0.1-legacy""
image.pullPolicyThe Keycloak image pull policyIfNotPresent
imagePullSecretsImage pull secrets for the Pod[]
hostAliasesMapping between IPs and hostnames that will be injected as entries in the Pod's hosts files[]
enableServiceLinksIndicates whether information about services should be injected into Pod's environment variables, matching the syntax of Docker linkstrue
podManagementPolicyPod management policy. One of Parallel or OrderedReadyParallel
updateStrategyStatefulSet update strategy. One of RollingUpdate or OnDeleteRollingUpdate
restartPolicyPod restart policy. One of Always, OnFailure, or NeverAlways
serviceAccount.createSpecifies whether a ServiceAccount should be createdtrue
serviceAccount.nameThe name of the service account to use. If not set and create is true, a name is generated using the fullname template""
serviceAccount.annotationsAdditional annotations for the ServiceAccount{}
serviceAccount.labelsAdditional labels for the ServiceAccount{}
serviceAccount.imagePullSecretsImage pull secrets that are attached to the ServiceAccount[]
rbac.createSpecifies whether RBAC resources are to be createdfalse
rbac.rulesCustom RBAC rules, e. g. for KUBE_PING[]
podSecurityContextSecurityContext for the entire Pod. Every container running in the Pod will inherit this SecurityContext. This might be relevant when other components of the environment inject additional containers into running Pods (service meshes are the most prominent example for this){"fsGroup":1000}
securityContextSecurityContext for the Keycloak container{"runAsNonRoot":true,"runAsUser":1000}
extraInitContainersAdditional init containers, e. g. for providing custom themes[]
skipInitContainersSkip all init containers (to avoid issues with service meshes which require sidecar proxies for connectivity)false
extraContainersAdditional sidecar containers, e. g. for a database proxy, such as Google's cloudsql-proxy[]
lifecycleHooksLifecycle hooks for the Keycloak container{}
terminationGracePeriodSecondsTermination grace period in seconds for Keycloak shutdown. Clusters with a large cache might need to extend this to give Infinispan more time to rebalance60
clusterDomainThe internal Kubernetes cluster domaincluster.local
commandOverrides the default entrypoint of the Keycloak container[]
argsOverrides the default args for the Keycloak container[]
extraEnvAdditional environment variables for Keycloak""
extraEnvFromAdditional environment variables for Keycloak mapped from a Secret or ConfigMap""
priorityClassNamePod priority class name""
affinityPod affinityHard node and soft zone anti-affinity
topologySpreadConstraintsTopology spread constraintsConstraints used to spread pods
nodeSelectorNode labels for Pod assignment{}
tolerationsNode taints to tolerate[]
podLabelsAdditional Pod labels{}
podAnnotationsAdditional Pod annotations{}
livenessProbeLiveness probe configuration

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 v18.10.0 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