<p>I'm not sure what the difference is between the CNI plugin and the Kube-proxy in Kubernetes. From what I get out of the documentation I conclude the following:</p>

<p>Kube-proxy is responsible for communicating with the master node and routing.</p>

<p>CNI provides connectivity by assigning IP addresses to pods and services, and reachability through its routing deamon. </p>

<p>the routing seems to be an overlapping function between the two, is that true? </p>

<p>Kind regards, 
Charles</p>

Charles Van Damme
<p><strong>OVERLAY NETWORK</strong></p>

<p>Kubernetes assumes that every pod has an IP address and that you can communicate with services inside that pod by using that IP address. When I say “overlay network” this is what I mean (“the system that lets you refer to a pod by its IP address”).</p>

<p>All other Kubernetes networking stuff relies on the overlay networking working correctly.</p>

<p>There are a lot of overlay network backends (calico, flannel, weave) and the landscape is pretty confusing. But as far as I’m concerned an overlay network has 2 responsibilities:</p>

<ol>
<li>Make sure your pods can send network requests outside your cluster</li>
<li>Keep a stable mapping of nodes to subnets and keep every node in your cluster updated with that mapping. Do the right thing when nodes are added &amp; removed.</li>
</ol>

<p><strong>KUBE-PROXY</strong></p>

<p>Just to understand kube-proxy, Here’s how Kubernetes services work! A service is a collection of pods, which each have their own IP address (like 10.1.0.3, 10.2.3.5, 10.3.5.6)</p>

<ol>
<li>Every Kubernetes service gets an IP address (like 10.23.1.2)</li>
<li>kube-dns resolves Kubernetes service DNS names to IP addresses (so my-svc.my-namespace.svc.cluster.local might map to 10.23.1.2)</li>
<li>kube-proxy sets up iptables rules in order to do random load balancing between them.</li>
</ol>

<p>So when you make a request to my-svc.my-namespace.svc.cluster.local, it resolves to 10.23.1.2, and then iptables rules on your local host (generated by kube-proxy) redirect it to one of 10.1.0.3 or 10.2.3.5 or 10.3.5.6 at random.</p>

<p>In short, <code>overlay networks</code> define the underlying network which can be used for communicating the various component of kubernetes. While <code>kube-proxy</code> is a tool to generate the IP tables magic which let you connect to any of the pod(using servics) in kubernetes no matter on which node that pod exist.</p>

<p>Parts of this answer were taken from this blog:</p>

<blockquote>
  <p><a href="https://jvns.ca/blog/2017/10/10/operating-a-kubernetes-network/" rel="noreferrer">https://jvns.ca/blog/2017/10/10/operating-a-kubernetes-network/</a></p>
</blockquote>

<p>Hope this gives you brief idea about kubernetes networking.</p>
