Network Design Principles

Kubernetes Network Source: https://kubernetes.io/docs/concepts/cluster-administration/networking/#kubernetes-ip-address-ranges

Node Network

The Node Network consists of Kubernetes worker nodes and control plane nodes. All nodes can communicate with each other.

  • Every node in the Kubernetes cluster should be able to communicate with every other node without NAT (Network Address Translation).

  • Kubernetes assumes a flat network where all nodes can talk freely.

  • Nodes usually have a routable IP address within the cluster.

To see Nodes IP we can use command kubectl get nodes -o wide.

➜ kubectl get nodes -o wide
NAME       STATUS   ROLES           AGE   VERSION   INTERNAL-IP    
minikube   Ready    control-plane   19h   v1.31.0   192.168.49.2   

EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION     CONTAINER-RUNTIME
<none>        Ubuntu 22.04.4 LTS   6.10.14-linuxkit   docker://27.2.0

Pod Network

The Pod Network is where all Kubernetes pods communicate. Pods within the cluster communicate using direct IP routing.

  • Every pod gets a unique IP Address.

  • Every pod in a Kubernetes cluster gets a unique IP address.

  • Pod-to-pod communication happens directly without NAT.

  • The Container Network Interface (CNI) plugin is responsible for managing pod networking.

  • Container inside the same pod communicate by localhost.

We can test pod to pod communication by ping from a pod to other pod.

Service Network

The Service Network is a virtual network used for Kubernetes Services. Services get a stable ClusterIP that does not change. Kubernetes load-balances traffic across backend pods.

Kubernetes rewrites outbound traffic from a pod if it's destined for a Service.This ensures that the request is routed correctly to a backend pod.

  • Services use ClusterIP (virtual IP) to route traffic to pods.

  • kube-proxy manages service traffic using iptables or IPVS.

Get service endpoints:

References

Last updated