1.

Having a Pod with two containers, can I ping each other? like using the container name?

Answer»

CONTAINERS on same pod ACT as if they are on the same machine. You can ping them using LOCALHOST:port itself. Every container in a pod shares the same IP. You can `ping localhost` inside a pod. Two containers in the same pod share an IP and a network namespace and They are both localhost to each other. Discovery works like this: Component A's pods -> Service Of Component B -> Component B's pods and Services have domain names servicename.namespace.svc.cluster.local, the dns search path of pods by default INCLUDES that stuff, so a pod in namespace Foo can find a Service bar in same namespace Foo by connecting to `bar`



Discussion

No Comment Found

Related InterviewSolutions