Hello i follow the course about CKA and after all we saw on bridge networking, a . . .

Krasevec de Raucourt:
Hello i follow the course about CKA and after all we saw on bridge networking, allowing traffic between container/pods on the same hosts and then through different nodes with a router or a CNI solution, I dont understand why we need suddenly services to make communication between pods whereas the network solution previously deployed already allow it. I understand the utility of the node port which permit to create external access to our pods, simultaneously on each node and permit port mapping between host and the container but what about the cluster IP services which does’nt matter, if the bridge network (and CNI network) is already setup => every pods of a node can already communicate between them inside the node (and also with pods of other nods if the CNI network plugins is deployed)

Sanket:
hi i also had the same thing in my mind, but then realized this: consider a scenario where you are accessing mysql with pod IP and port from another pod in the same cluster, and the mysql pod is deployed as a part of deployment/replicaset/statefulset and this mysql pod gets crashed due to some reason, so now the deployment creates a new one in its place to maintain the desired number of replicas, now in this case the pod will get a different IP and it will be difficult for the other pod to connect to this mysql pod. to avoid this you have a service called clusterIP which will be a logical representation of the pods you want to expose internally for the matched selector.

Krasevec de Raucourt:
Hi thanks for your response. So can we considered the service as a static IP that we attached to the pod with the same selectorName, but if the mysql deployment crash, why the new pod with the new address will have difficult to communicate with other Pods. When the new pod is created its network configuration is made by CNI plugins which attached the new container/pod to the cluster network and made it available by all the other Pods (internally on the same node thanks to the bridge network and on the other node thanks to CNI agent/peers). So why do we need services cluster IP ?

Sanket:
by difficult to communicate, what i mean, is that how will the other pod know the new ip of the pod to connect. it has ability to connect as the cni will configure those things, but the configuration of the app / client in the pod that connects to the mysql pod will have the ip of old one and it will fail. so yes in a way clusterip service can be thought as a static ip to the selected pods

Krasevec de Raucourt:
Ok thank you very much ^^

unnivkn:
Hi @Krasevec de Raucourt fyr:
https://www.tutorialworks.com/kubernetes-pod-communication/