Kubernetes doesn't support this natively.
The easiest way to do it is to share a volume between the two containers in the pod and use a file as a sentinel.
Brendan
--
You received this message because you are subscribed to the Google Groups "Containers at Google" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-contain...@googlegroups.com.
To post to this group, send email to google-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-containers.
For more options, visit https://groups.google.com/d/optout.
Yeah, in this context of agree with Tim. Your second service should be capable of handling the fact that it can't yet connect and wait for the service it wants to talk to to come up. Your system still be more robust on general if you design it that way.
I'd go out on a limb a little and say there are some use cases where an 'init' container makes sense (eg schema migration) but it tends to be more of a 'run before' than a 'wait for dependencies' type case.
Brendan
What happens when service 1 crashes and restarts? Service 2 HAS to
handle it, right? So don't special-case startup. It's simply an
example of when service 2 must do something without service 1.
The idea would be that the kubelet runs the init container to completion (eg return code zero) before starting any other containers in the pod.
Note this doesn't exist now, and it's not clear to everyone (or even me) that we definitely want to add it to k8s, but it has been discussed in the past.
You can now or less emulate this with a shared volume in a pod and synchronizing via a shared file.
Brendan