I was asked about it, and I couldn't find info about it online - Which algorithm Kubernetes uses to nevigate traffics in replicaset or deployment (I guess that they the same) for pods?
Lets say, I have replica of 5 pods in my Kubernetes cluster, defined in replicaset. How does the cluster pick which pod to go to, in new request? Is it uses round-robin? I couldn't find info about it.
The algorithm applied to determine which pod will process the request depends on kube-proxy mode that is running.
In 1.0, the proxy works in mode called userspace and default algorithm is round robin.
In 1.2 mode iptables proxy was added, but still round robin is used due to iptables limitations.
In 1.8.0-beta, IP Virtual Server (IPVS) was introduced, it allow much more algorithms options, like:
References:
https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies https://sookocheff.com/post/kubernetes/understanding-kubernetes-networking-model/