How two kubernetes pods can communicate?

8/17/2020

I have created 2 PODS. In one POD I have kept all the machine learning model pickle file and in another one I have kept flask api code(app.py). How flaskapi POD will communicate with mlPickleFile POD?

-- Saurabh Kumar
data-science
deployment
docker
kubernetes
python

1 Answer

8/17/2020

There are two ways the pods can communicate with each other.

1. Shared Storage

The pod configuration allows specifying shared storage volumes. There are multiple options for shared volumes in Kubernetes. Each has its own behavior and working configuration. However it is less likely in your use case that you should create a shared volume and share information with eachother.

2. Pod Networking

The pods are available for each other via network. The network configuration depends on how you create your pods. In the most simplistic configuration, the pods are configured to be operated in a virtual local network. All the pods are operated in the same subnet in the cluster in this config. One pod can be reached out by anothers via its cluster ip or cluster dns entry which exposes your pod under a service name.

For example -

The application X, if creates the service service-x, it is available for all other pods by:

http://service-x

inside the cluster.

-- Charlie
Source: StackOverflow