Search code examples
kubernetesfluxcd

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


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?


Solution

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