Using CloudNativePG storage
The benchmark deployment of Keycloak can use a PostgreSQL cluster managed by the CloudNativePG Operator.
Enabling CloudNativePG storage
Use the following settings to select and customize the CloudNativePG operator:
KC_DATABASE=cnpg
CNPG_VERSION=1.28.0
CNPG_INSTANCES=1
See Customizing the deployment for a list of all configuration options.
After every change, re-run the task command to apply the changes to the minikube instance.
Task will trigger the necessary scripts and will use the minimal steps to update the minikube.
Running rebuild.sh is not required: It will destroy the complete instance and will take a lot longer to complete.
This will install a CloudNativePG operator inside the cnpg-system namespace,
and a PostgreSQL cluster within the cnpg-keycloak namespace.
Appropriate secrets for securing Keycloak’s JDBC connections and access to the database
will be created in the keycloak namespace.
Verifying the setup
The automated script verifies that Keycloak starts up.
Verifying the CloudNativePG operator:
kubectl -n cnpg-system rollout status deployment cnpg-controller-manager
Verifying the CloudNativePG cluster:
kubectl -n cnpg-keycloak get pods
kubectl -n cnpg-keycloak get cluster cnpg-keycloak -ojson | jq -r .status.conditions
Identifying PostgreSQL instance roles:
echo "Primary"
kubectl -n cnpg-keycloak get pods -l cnpg.io/cluster=cnpg-keycloak -l cnpg.io/instanceRole=primary -oname
echo "Replicas"
kubectl -n cnpg-keycloak get pods -l cnpg.io/cluster=cnpg-keycloak -l cnpg.io/instanceRole=replica -oname
Metrics and Dashboards
Database metrics are available in Grafana on the preconfigured CloudNativePG Dashboard.