Configure Ingress and TLS
This guide describes how to expose a Keycloak instance externally via Kubernetes Ingress with TLS encryption enabled, which is required for production deployments.
TOC
TLS Configuration ModesPrerequisitesStep 1: Create the TLS SecretStep 2: Update the Keycloak CRStep 3: Verify the IngressStep 4: Verify HTTPS AccessConfiguration ReferenceTLS Configuration Modes
Alauda Build of Keycloak supports two distinct TLS modes. Choose the one that matches your infrastructure:
This guide demonstrates the Ingress TLS mode (recommended for most Kubernetes environments).
Prerequisites
- A running Keycloak instance (see Install).
- A valid TLS certificate and private key for the target hostname.
- An Ingress controller (for example, NGINX) deployed in the cluster.
Step 1: Create the TLS Secret
Create a Kubernetes TLS Secret from your certificate and private key:
Verify the Secret was created:
Step 2: Update the Keycloak CR
Update your Keycloak CR to enable Ingress with TLS and configure the hostname:
Apply the updated manifest:
Step 3: Verify the Ingress
Check that the Ingress resource was created and has the correct hostname:
Expected output:
Step 4: Verify HTTPS Access
Access the Keycloak Admin Console at https://keycloak.example.com and confirm the connection is secure.
Check that Keycloak is ready:
Configuration Reference
When using a reverse proxy or Ingress controller, you must set spec.proxy.headers correctly. An incorrect configuration may expose Keycloak to security vulnerabilities by trusting spoofed headers.