Home > Blockchain >  Is it possible to configure Kubernetes to deploy services in a specific order?
Is it possible to configure Kubernetes to deploy services in a specific order?

Time:10-29

I have 3 services that are based on the same image, they're basically running the same app in 3 different configurations. 1 service is responsible for running migrations and data updates which the other 2 services will need. So I need this 1 service to be deployed first before the other 2 will be deployed. Is there any way to do this?

CodePudding user response:

I would look for a solution outside of Kubernetes.

Assuming that you have a release pipeline to deploy the changes, you could have a step to migrate and update the database. If the migration step succeeds, then deploy all the new services.

If you really have to use K8S, see the InitContainers doc.

CodePudding user response:

I assume that the two services which are dependent on service 1 are either Pod, Deployment or ReplicaSet. So, make use of Init Containers.

Here is an example that will make a pod wait until the dependent services are up and running. busybox is most common image used for init containers that supports variety of linux commands that will help you check the status of dependent services.

  • Related