Basic Kubernetes Architecture
The above figure shows a 3-node Kubernetes Architecture.
The 3 nodes have 3,3 and 2 pods deployed respectively.
Every node has some containers running within them. For example, Pod 1 of Node 1 has 3 containers running inside it.
There is also a Load Balancer/Ingress that acts as a single entry point from the internet to the nodes or cluster in general.
kubelet is responsible for launching the pods.
kubelet also watches for pods via Kubernetes API server.
The kubelet is also responsible for registering a node with a Kubernetes cluster, sending events and pod status, and reporting resource utilization.
The kubelet connects with the master node to collect the above information.
kube-proxy will feed its information about what pods are on these nodes
to firewall or iptables. iptables is the firewall in Linux and used to route traffic.
So, whenever a new pod is launched then kub-proxy is going to change the iptables rules to make sure
that the pod is routable within the cluster.
Client from internet connects to Load Balancer or the Ingress.
LB forwards the traffic to cluster.
The traffic then arrives at the iptables.
And as highlighted earlier iptables has the rules to forward traffic to another node or the same node.(wherever the sought after pod is based).