Communication between PODs

It is correct to say that for communication between the CONTAINERS deployed in PODs (1 POD => 1 CONTAINER), within the same CLUSTER, it should be through SERVICE objects.

But in the cases of PODs of the SIDECAR type that handle 2 CONTAINERS, the SIDECAR that supports the main CONTAINER, here how would the communication be carried out? I understand that directly since they share the same environment, but by means of what? ENVIRONMENT VARIABLES would be the best option ?.

Thank you.

By creating shared volume. Normally the type of volume is emptyDir

Hello @maktup,

The communication between two separate pods, If the container in pod1 work on port 80 so pod2 can access pod1 through service with type NodePort.

Regarding the POD with sidecar, as they are in the same environment the sidecar container can communicate with the main container through and also you can use shared volume as a simple and efficient way to share data between containers in a Pod.