
Ask HN: Kubernetes Service Dependencies and Bootstrapping clusters - psankar
We are using kubernetes. We have about 15 or so pods&#x2F;services, about 3-4 statefulsets. Things work fine and we are happy with kubernetes so far.<p>However, for our dev setups and also for CI, we are looking for a better solution. These 15 services have a few hierarchical dependencies. For example, the postgres stateful set should be brought up first, followed by the users service and then the auth service.<p>The users&#x2F;auth service will work fine (albeit returning 5xx errors) even without the other services being up. However, if all the services start together, they will all compete for the tiny amounts of CPU that we have given and eventually some starve and kind of gets into weird unrecoverable situations (in CI and test clusters where we can&#x27;t give max cpu&#x2F;mem).<p>I know of ways to increase the cpu&#x2F;mem limit but keep the initial allocations, small. But I believe that since I know about service dependencies better, if I bring up kubernetes pods&#x2F;services in a hierarchical way, it would be far more useful for me.<p>Do any of you that use kubernetes, use any tools&#x2F;hacks&#x2F;techniques to bring up pods&#x2F;services in particular order (without lots of kubectl waits) ? In the past, with `docker-compose` I was able to achieve this via service dependencies but can&#x27;t find similar in kubernetes. Any pointers ?
======
aliswe
How about some kind of startup condition as a proxy for your original
entrypoint?

May I ask why you're running DB and stateful systems in k8s in the first
place? The benefits of doing it is not likely to outweigh the difficulty of
getting it right.

~~~
psankar
> May I ask why you're running DB and stateful systems in k8s in the first
> place?

Because it is the easiest way to get our integration tests in CI working fine.
We may change in future, if there is a need.

~~~
aliswe
As a suggestion, why not run docker in docker instead? Then you can start your
systems serially and finetune network settings, maybe even seed some data etc.

A dockerfile based docker on with simple shell script should do. Maybe even a
docker exec but that's pushing it.

I love k8s but in this case it seems like wrong tool for the job.

Tell me uf you'd like some sample code.

