Search code examples
kubernetesreplicaset

Kubernetes always uses the same replica


I have created deployment which has a service. I set it to run it in 5 replicas. When I call the service it always uses the same replica (pod). Is there a way how to use round robin instead, so all pods will be used? enter image description here


Solution

  • When you access your pods by service name, you get an IP address for one of the pods and use it in subsequent requests.

    To solve this problem, you can create an ingress and use the url instead of the service name, in this case you will get an IP address on each request, and the load will be distributed between the pods.