Specify scheduling order of a Kubernetes DaemonSet Specify scheduling order of a Kubernetes DaemonSet kubernetes kubernetes

Specify scheduling order of a Kubernetes DaemonSet


Kubernetes itself does not provide a way to specific dependencies between pods / deployments / services (e.g. "start pod A only if service B is available" or "start pod A after pod B").

The currect approach (based on what I found while researching this) seems to be retry logic or an init container. To quote the docs:

They run to completion before any app Containers start, whereas app Containers run in parallel, so Init Containers provide an easy way to block or delay the startup of app Containers until some set of preconditions are met.

This means you can either add retry logic to your application (which I would recommend as it might help you in different situations such as a short service outage) our you can use an init container that polls a health endpoint via the Kubernetes service name until it gets a satisfying response.


retry logic is preferred over startup dependency ordering, since it handles both the initial bringup case and recovery from post-start outages