We have added readiness probe and the container is in unready state until it is fully loaded but in case of horizontal autoscaling a new pod which is in unready state starts getting traffic due to which request are failing. We are using nginx ingress controller for loadbalancing and service type is of ClusterIPenter image description here
We tried adding readiness probes , probe is working and making sure that container is not ready state but somehow it is getting trafficenter image description here
Infra-cluster traffic is handled by the Services and the Services route as soon as the Pod is RUNNING.
What you can do is configure an initContainer that does a health check of the localhost:PORT of your service.
Check it out here: Kubernetes - wait for other pod to be ready
If you have the ability to create automatisms, you might also consider using the
kubectl waitcommand:https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait