keycloak

by CloudPirates

Helm chartv0.22.4App 26.8.2Apache-2.0Verified publisher

Open Source Identity and Access Management Solution

About this chart

Keycloak

A Helm chart for Keycloak - Open Source Identity and Access Management Solution. Keycloak provides user federation, strong authentication, user management, fine-grained authorization, and more. It supports modern standards like OpenID Connect, OAuth 2.0, and SAML.

Prerequisites

  • Kubernetes 1.24+
  • Helm 3.2.0+
  • PV provisioner support in the underlying infrastructure (if persistence is enabled)

Installing the Chart

To install the chart with the release name my-keycloak:

helm install my-keycloak oci://registry-1.docker.io/cloudpirates/keycloak

To install with custom values:

helm install my-keycloak oci://registry-1.docker.io/cloudpirates/keycloak -f my-values.yaml

Or install directly from the local chart:

helm install my-keycloak ./charts/keycloak

The command deploys Keycloak on the Kubernetes cluster in the default configuration. The Configuration section lists the parameters that can be configured during installation.

Uninstalling the Chart

To uninstall/delete the my-keycloak deployment:

helm uninstall my-keycloak

The command removes all the Kubernetes components associated with the chart and deletes the release.

Security & Signature Verification

This Helm chart is cryptographically signed with Cosign to ensure authenticity and prevent tampering.

Public Key:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5U+rM2d3hDjgP5T3cLShuuQIU9vR
Z4/G+Nug6q5vRa+C3qUA1wXjbaJFAfcIrv5VjmYAYOj13shnPpp3Zh4fnQ==
-----END PUBLIC KEY-----

To verify the helm chart before installation, copy the public key to the file cosign.pub and run cosign:

cosign verify --key cosign.pub registry-1.docker.io/cloudpirates/keycloak:<version>

Configuration

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

Global parameters

ParameterDescriptionDefault
global.imageRegistryGlobal Docker image registry""
global.imagePullSecretsGlobal Docker registry secret names as an array[]

Common parameters

ParameterDescriptionDefault
nameOverrideString to partially override keycloak.fullname""
fullnameOverrideString to fully override keycloak.fullname""
namespaceOverrideString to override the namespace for all resources""
commonLabelsLabels to add to all deployed objects{}
commonAnnotationsAnnotations to add to all deployed objects{}

Keycloak image configuration

ParameterDescriptionDefault
image.registryKeycloak image registrydocker.io
image.repositoryKeycloak image repositorykeycloak/keycloak
image.tagKeycloak image tag (immutable tags are recommended)"26.5.5@sha256:a7b0cb7a43a1235a61872883414d3f1d9a3ceac9df6e5907bd12202778a6265c"
image.imagePullPolicyKeycloak image pull policyAlways
image.commandKeycloak container entrypoint command"/opt/keycloak/bin/kc.sh"

Deployment configuration

ParameterDescriptionDefault
replicaCountNumber of Keycloak replicas to deploy1
revisionHistoryLimitNumber of old StatefulSet revisions to retain for rollback10

Pod annotations and labels

ParameterDescriptionDefault
podAnnotationsMap of annotations to add to the pods{}
podLabelsMap of labels to add to the pods{}

Pod configuration

ParameterDescriptionDefault
shareProcessNamespaceEnable process namespace sharing between containers in the podfalse
terminationGracePeriodSecondsSeconds Kubernetes waits for the Keycloak pod to terminate. Leave empty to use the Kubernetes default""
lifecycleLifecycle hooks for the Keycloak container{}

Extra volumes and volumes mount

ParameterDescriptionDefault
extraVolumesArray of Volume to add to the keycloak pod[]
extraVolumeMountsArray of VolumeMount to add to the keycloak container[]
preserveThemesDisable mounting an emptyDir over /opt/keycloak/themes, preserving the themes bundled in the imagefalse
preserveProvidersDisable mounting an emptyDir over /opt/keycloak/providers, preserving the providers bundled in the imagefalse

Extra init containers for Keycloak pod

ParameterDescriptionDefault
extraInitContainersArray of initContainer to add to the keycloak pod. Supports Helm template expressions (see Template Expressions in Extra Fields).[]

Extra containers for Keycloak pod

ParameterDescriptionDefault
extraContainersArray of containers to add to the keycloak pod[]

Security

ParameterDescriptionDefault
podSecurityContext.fsGroupGroup ID for the volumes of the pod1001
podSecurityContext.seccompProfileSeccomp profile for the pod{type: RuntimeDefault}
containerSecurityContext.allowPrivilegeEscalationEnable container privilege escalationfalse
containerSecurityContext.runAsNonRootConfigure the container to run as a non-root usertrue
containerSecurityContext.runAsUserUser ID for the Keycloak container1001
containerSecurityContext.runAsGroupGroup ID for the Keycloak container1001
containerSecurityContext.readOnlyRootFilesystemMount container root filesystem as read-onlyfalse
containerSecurityContext.capabilities.dropLinux capabilities to be dropped["ALL"]

Keycloak Configuration

ParameterDescriptionDefault
keycloak.adminUserKeycloak admin usernameadmin
keycloak.adminPasswordKeycloak admin password""
keycloak.existingSecretName of existing secret to use for Keycloak admin credentials""
keycloak.secretKeys.adminPasswordKeySecret key for admin credentials"admin-password"
keycloak.hostnameKeycloak hostname including scheme (e.g. https://keycloak.example.com)""
keycloak.hostnameAdminKeycloak admin hostname including scheme (e.g. https://keycloak.example.com)""
keycloak.hostnameStrictEnable strict hostname resolutionfalse
keycloak.hostnameBackchannelKeycloak backchannel hostname including scheme (e.g. https://keycloak.example.com)""
keycloak.httpEnabledEnable HTTP listenertrue
keycloak.httpsEnabledEnable HTTPS listener (only when Keycloak itself terminates TLS via tls.enabled)false
keycloak.httpPortHTTP port8080
keycloak.httpsPortHTTPS port8443
keycloak.proxyHeadersProxy headers to trust (forwarded or xforwarded). Must be set when running behind a reverse proxy (e.g. nginx ingress). Leave empty only when Keycloak is directly exposed without a proxy.""
keycloak.proxyProtocolEnabledWhether the server should use the HA PROXY protocol when serving requests from behind a proxy. (true, false)false
keycloak.proxyTrustedAddressesA comma separated list of trusted proxy addresses""
keycloak.productionEnable production mode (runs start instead of start-dev). Should only be disabled for local development.true
keycloak.httpRelativePathSet relative path for serving resources; must start with a //
keycloak.extraArgsPrefixAdditional arguments to pass before the start command (e.g., for --config-file)[]
keycloak.extraArgsAdditional arguments to pass to the Keycloak startup command[]

TLS Configuration

ParameterDescriptionDefault
tls.enabledEnable TLS/HTTPS support using custom certificatesfalse
tls.existingSecretName of existing secret containing TLS certificate and key (PEM format, keys: tls.crt, tls.key)""
tls.certificateFilePath where the TLS certificate file will be mounted (internal)"/opt/keycloak/certs/tls.crt"
tls.certificateKeyFilePath where the TLS certificate key file will be mounted (internal)"/opt/keycloak/certs/tls.key"
tls.certManager.enabledEnable cert-manager integration for automatic certificate provisioningfalse
tls.certManager.issuerRef.nameName of the cert-manager Issuer or ClusterIssuer""
tls.certManager.issuerRef.kindKind of the cert-manager issuer (Issuer or ClusterIssuer)`

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 v0.22.4 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