Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Kubernetes Service Dependencies and Bootstrapping clusters
4 points by psankar 3 days ago | hide | past | web | favorite | 3 comments
We are using kubernetes. We have about 15 or so pods/services, about 3-4 statefulsets. Things work fine and we are happy with kubernetes so far.

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.

The users/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't give max cpu/mem).

I know of ways to increase the cpu/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/services in a hierarchical way, it would be far more useful for me.

Do any of you that use kubernetes, use any tools/hacks/techniques to bring up pods/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't find similar in kubernetes. Any pointers ?

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.

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

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.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact