<p>I have a problem with my database migration inside kubernetes.</p>

<p>Actually, i execute an initcontainer script when my pods started.</p>

<p>But this process is very long (10minutes).</p>

<p>When i kill my pod,  this process of initcontainer restart, but it's not really necessary when it's not an upgrade of version. 10 minutes later....</p>

<p>What is the best way to do a database update when my version of image is different ?</p>

<p>Usually, the upgrade engine, e.g. alembic in python or flyweight in java are checking DB schema versions before running migrations. If you use bare SQL scrips you can mimic this behavior - add a column called db_versions, write version there and then check before running.</p>
