


Every Pod in Kubernetes is assigned an IP address upon its creation, allowing it to communicate within the cluster. You can easily inspect a Pod’s IP address using the -o wide option or by describing the Pod.
For instance, creating a an Pod and inspecting its details.
The IP address assigned to a Pod is unique across all nodes and namespaces. This is achieved by allocating a dedicated subnet to each node during the registration process.In case of Mirco K8s which uses Calico there is no static podCIDR per node instead it uses IP pools. Each node gets Pod IPs from a global Calico IP pool. To check the IP Pool range , you can get the ippools value.
In the above output you can see the pod IP 10.1.243.214 is from the IP pool range 10.1.0.0/16. This clearly shows how Calico manages IP address for Pods in case of Micro K8s.
The kube-proxy manages Pod networking, ensuring seamless communication between Pods, and this process is closely integrated with the DNS service and the CNI (Container Network Interface).
Pods on a node can communicate with all other Pods running on any other node or with in the same node of the cluster.
You can easily verify the behavior let create the above spec.
Let’s start with a custom index.html file for our nginx container. Create a config map and mount this to our container.
Now let’s create a test-pod which contains a alpine-container which we will use as a client to hit nginx container which is into a different pod.
Now it is time to create another pod which contains the custom nginx container.
Now it is time to test the connection to see how containers inside two different pods can communicate with each other.
It’s crucial to recognize that a Pod’s IP address is not persistent over time. When a Pod is restarted, it is assigned a new IP address. In a microservices architecture, where each application runs in its own Pod and needs to communicate with others through a stable network interface, a different approach is needed — the use of a Service. It is worth to have a dedicated blog for this see you in a new blog again …..
Source Credit: https://medium.com/google-cloud/cka-certification-understanding-pod-networking-93fba500a29c?source=rss—-e52cf94d98af—4