Search code examples
amazon-web-serviceskuberneteskops

How to set the startup order of pods of a kubernetes cluster?


I have a kubernetes cluster that is setup using kops on AWS.

I don't need this cluster during weekends.

So I close it by setting its auto-scaling group's minimum and maximum capacity to 0 on Friday.

The problem with this method is that the startup order of the pods is not fixed.

I mean when I opens the cluster on Monday, sometimes pod A starts before pod B, sometimes pod B starts before pod A.

Is it possible to set the startup order of the pods in this situation?


Solution

  • In short, no. You can use pod priority to influence the scheduling order of Pods. But most likely both Pod A and Pod B will schedule closely after each other given capacity. Then factors like image download time and image startup time will determine when a Pod actually starts.

    If you need e.g a database to be available before its clients, you can use init containers to make the main container wait on a certain condition before starting.