DevOps

Database migrations in Kubernetes applications with Flyway

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

Published on Java Code Geeks with permission by Sebastian Daschner, partner at our JCG program. See the original article here: Database migrations in Kubernetes applications with Flyway (Video)

Opinions expressed by Java Code Geeks contributors are their own.

Sebastian Daschner

Sebastian Daschner is a self-employed Java consultant and trainer. He is the author of the book 'Architecting Modern Java EE Applications'. Sebastian is a Java Champion, Oracle Developer Champion and JavaOne Rockstar.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button