Database migration with kubernetes helm deployement

11/4/2019

I have a problem with my database migration inside kubernetes.

Actually, i execute an initcontainer script when my pods started.

But this process is very long (10minutes).

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....

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

-- DevOpsAddict
database
kubernetes
updates

1 Answer

11/4/2019

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.

-- Max Lobur
Source: StackOverflow