Chris Hambridge
1 min readMar 22, 2020

Hemant Yadav — Depending on what technologies are in your stack , if you are trying to control multiple pods attempting to run the migration you could use something like Redis or Memcache as a “lock”. Each of the init containers could check if another container is performing the migration (use the downward API to set which pod is doing this: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-pod-fields-as-values-for-environment-variables). If another pod is performing the migration you could sleep for a specified amount of time checking the migrations table for completion (something like this https://stackoverflow.com/a/8491203) and after awhile (exponential back-off?) if not completed you could have the current container perform the migration. Hope that is a helpful suggestion.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Chris Hambridge
Chris Hambridge

Written by Chris Hambridge

Software Engineer at Red Hat. Passionate about devOps and cloud native technologies.

No responses yet

Write a response