Keycloakx: Automate minor/major upgrade process in cluster mode#898
Keycloakx: Automate minor/major upgrade process in cluster mode#898maarous wants to merge 2 commits intocodecentric:masterfrom
Conversation
Signed-off-by: Mohamed Amine AROUS <mohamed.amine.arous93@gmail.com>
|
Hi! When trying out your feature, my local cluster of 3 Keycloaks scales down, but not up anymore.
The
which lets the helm upgrade command fail. Did you experience the same issues? |
Hello @dominiquemetz , thank you for your quick reply. Unfortunately, I haven’t been able to reproduce the issue on my side. I tested this setup locally using Minikube and also deployed it across our vanilla Kubernetes clusters in all environments without encountering any problems. For reference, I retested using:
The issue still did not occur. Here is the values file I used: replicas: 3
command:
- "/opt/keycloak/bin/kc.sh"
- "start"
- "--http-port=8080"
- "--hostname-strict=false"
extraEnv: |
- name: KEYCLOAK_ADMIN
value: admin
- name: KEYCLOAK_ADMIN_PASSWORD
value: admin
- name: JAVA_OPTS_APPEND
value: >-
-Djgroups.dns.query={{ include "keycloak.fullname" . }}-headless
affinity: ""
updateHook:
enabled: true
kubernetesApi:
url: https://192.168.49.2
port: 8443
cidr: 192.168.49.2/32I’ll attach the results here for reference. Out of curiosity, are you using Helm v4? |
|
I think it's better to disable this feature by default (for new cluster set up and for patch update that are supported natively in Keycloak HA). I will add also some improvements. |
Signed-off-by: Mohamed Amine AROUS <mohamed.amine.arous93@gmail.com>
Keycloak does not support minor or major version upgrades while running in cluster mode. Only patch updates are supported.
(Refer to the official Keycloak documentation for more details.)
If you attempt such an upgrade in cluster mode, you may encounter errors due to JGroups version mismatches, for example:
Because of this limitation, downtime is required to perform minor or major version upgrades.
Recommended upgrade procedure:
To simplify this process, this pull request introduces a new parameter
updateHookthat automates these steps.You can see in this GIF a test of upgrading a three-instance cluster from version 26.5.6 to version 26.6.1.
I took this opportunity to upgrade Keycloak to the latest version, 26.6.1.