<p>I have an Application that run with 10 Replicas. I need to migrate the DB and migrate some otherstuff too. My migration can run as often as it likes, but not parallel. I like to create a SpringBoot Application that exits after the migration and define it in Helm as &quot;pre-install,pre-upgrade&quot;.</p>
<p>Some people say that i should put the migration direct into my main application. Kubernetes will ensure that new pods will start up sequential and the migration will never run parallel.</p>
<p>Question:</p>
<p>I found that recommendation how to migrate, maybe you have some other good links that fit my problem.
<a href="https://itnext.io/database-migrations-on-kubernetes-using-helm-hooks-fb80c0d97805" rel="nofollow noreferrer">https://itnext.io/database-migrations-on-kubernetes-using-helm-hooks-fb80c0d97805</a></p>

user286974
<p>Consider using a specialized tool for database migrations like Liquibase or flyway. Both have excellent integration with Spring Boot. (Locking to avoid parallel execution is handled by the tools.)
Using kubernetes concepts you could implement the database migration as a <code>Job</code> and run it separately. If you chose that approach I would recommend a migration tool like liquibase as well.</p>
