apiVersion: v1
kind: Secret
metadata:
name: remote-store-secret
namespace: keycloak
type: Opaque
data:
username: ZGV2ZWxvcGVy # base64 encoding for 'developer'
password: c2VjdXJlX3Bhc3N3b3Jk # base64 encoding for 'secure_password'
This topic describes advanced Infinispan configurations for Keycloak on Kubernetes.
This connects Keycloak to Infinispan using TCP connections secured by TLS 1.3.
It uses the Keycloak’s truststore to verify Infinispan’s server certificate.
As Keycloak is deployed using its Operator on OpenShift in the prerequisites listed below, the Operator already added the service-ca.crt
to the truststore which is used to sign Infinispan’s server certificates.
In other environments, add the necessary certificates to Keycloak’s truststore.
Deploy Keycloak for HA with the Keycloak Operator as it will be extended.
Create a Secret with the username and password to connect to the external Infinispan deployment:
apiVersion: v1
kind: Secret
metadata:
name: remote-store-secret
namespace: keycloak
type: Opaque
data:
username: ZGV2ZWxvcGVy # base64 encoding for 'developer'
password: c2VjdXJlX3Bhc3N3b3Jk # base64 encoding for 'secure_password'
Extend the Keycloak Custom Resource with additionalOptions
as shown below.
All the memory, resource and database configurations are skipped from the CR below as they have been described in Deploy Keycloak for HA with the Keycloak Operator guide already. Administrators should leave those configurations untouched. |
apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
labels:
app: keycloak
name: keycloak
namespace: keycloak
spec:
additionalOptions:
- name: cache-remote-host (1)
value: "infinispan.keycloak.svc"
- name: cache-remote-port (2)
value: "11222"
- name: cache-remote-username (3)
secret:
name: remote-store-secret
key: username
- name: cache-remote-password (4)
secret:
name: remote-store-secret
key: password
- name: spi-connections-infinispan-quarkus-site-name (5)
value: keycloak
1 | The hostname of the remote Infinispan cluster. |
2 | The port of the remote Infinispan cluster.
This is optional and it default to 11222 . |
3 | The Secret name and key with the Infinispan username credential. |
4 | The Secret name and key with the Infinispan password credential. |
5 | The spi-connections-infinispan-quarkus-site-name is an arbitrary Infinispan site name which Keycloak needs for its Infinispan caches deployment when a remote store is used.
This site-name is related only to the Infinispan caches and does not need to match any value from the external Infinispan deployment.
If you are using multiple sites for Keycloak in a cross-DC setup such as Deploy Infinispan for HA with the Infinispan Operator, the site name must be different in each site. |
Value | |
---|---|
|
|
Available only when remote host is set |
|
Available only when remote host is set |
(default) |
Available only when remote host is set |
|
Available only when remote host is set |