sebastiandaschner blog

Database migrations in Kubernetes applications with Flyway (Video)

saturday, july 18, 2020

I’ve recorded a video how to migrate databases for applications that are deployed in a managed Kubernetes environment using Flyway and init containers. In order to achieve zero-downtime deployments, we need to make sure that our persistence concept supports N-1 compatibility, which requires us to be able to migrate our database schemas, ideally from reproducible scripts stored in version control.

Flyway is a widely-used tool to perform such migrations in an idempotent way.

In the video, I’m using Flyway in the command line mode, which will be packaged to a Docker image together with the migration scripts. We’ll use the image to perform the database migrations inside init containers, which run just before the deployment of our applications.

You can find the example project on GitHub. In the video, I use the managed IBM Cloud Kubernetes service and Databases for PostgreSQL service.

Further resources


Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java:

All opinions are my own and do not reflect those of my employer or colleagues.