<p>We have a Keycloak 15.1.1 deployment on Kubernetes with multiple replicas with the AWS RDS Postgres 13 Database backend. I did not find any upgrade guide or experience of other people regarding this setup or even with Kubernetes with Postgres using PVC upgrading Keycloak with multiple major version changes.</p>
<p>Does anyone have any experience with the Keycloak upgrade on Kubernetes?</p>
<p>I went through the change log and was able to run Keycloak locally using docker-compose only in HTTP mode as we terminate SSL at the reverse proxy.</p>
<p>From upgrade instructions from Keycloak <a href="https://www.keycloak.org/docs/latest/upgrading/index.html" rel="nofollow noreferrer">documentation</a> is the following strategy is the right one without losing any data</p>
<p>Update the docker image with a new image running only in HTTP mode in our helm charts</p>
<p>Initially start the new deployment with only a single replica so that the database schema changes are applied</p>
<pre><code>kc.sh start --spi-connections-jpa-default-migration-strategy=update
</code></pre>
<p>When I tried to upgrade my local deployment with the above command, Keycloak was not accessible until the next restart.</p>
<p>Restart the deployment with more replicas with command</p>
<pre><code>kc.sh start --optimized
</code></pre>

<p>I got the answer from the Keycloak GitHub support forums <a href="https://github.com/keycloak/keycloak/discussions/14682" rel="nofollow noreferrer">https://github.com/keycloak/keycloak/discussions/14682</a>.</p>
<p>Running kc.sh start automatically upgrades the DB on first install, and the first container running this command automatically locks the DB until migration is complete. So its not required to change my helm chart.</p>
