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