In recent times Kubernetes is becoming a de facto tool to be used and it adds a lot of value to your profile if you have a good understanding of it. Unfortunately, the way clouds have abstracted everything from users, there are not many people aware of how this actually works behind the scene and is actually using a very basic concept of networking instead of doing anything fancy.
What is the job of kube-proxy?
The main task of Kube-proxy is making
configurations so that packets can reach their destination when you call a service and not routing the packets. This must be clear to you, in the very basic configuration, when you talk about kube-proxy it doesn’t route the packets, it makes configuration so that packet can reach the destination.
What configuration does it make?
Kube-proxy creates iptables rules for the services that are created.
Kube proxy runs on each node and talks to api-server to get the details of the services and endpoints present. Based on this information, kube-proxy creates entries in iptables, which then routes the packets to the correct destination.
When you create any service in Kubernetes, the traffic can come on any of the nodes, and then its iptables will route the packet to the correct node and after that, it can reach the correct pod.
This post will not talk about a lot in depth how it is implemented. This was intended to give you a direction and to make you aware that kube-proxy uses iptables and ipvs behind the scenes to enable packets to reach their correct destination.
If you like the article please share and subscribe.