I have microservices deployed using k8s. There are some inter-microservice API calls. The issue is when I perform a release deployment, The services start accepting requests randomly in 40 to 100 seconds based on the application platform. So, some of the services start accepting requests earlier while others take more time to accept the first request. Here some API calls are service dependents. So, Until the full deployment is not performed, The applications are throwing errors because of the delayed deployment of dependent services. I have implemented rolling updates for smooth deployment hence there is no downtime during deployment of a particular application. But, there might be new API endpoints added in the new release which affects the other applications until it starts accepting requests.
During deployment, Is there any way I can configure all pods to start accepting requests at once on a particular time?
Let's say I have to update 5 services in the current release. Then all new 5 pods should start accepting requests at once.
If I understood you correctly you want to implement service dependencies so that dependent services won't start unless their required services are started. You can implement that using initContainers like that:
spec:
template:
spec:
initContainers:
- name: waitfor
image: jwilder/dockerize
args:
- -wait
- "http://config-srv:7000/actuator/health"
- -wait
- "http://registry-srv:8761/actuator/health"
- -wait
- "http://rabbitmq:15672"
- -timeout
- 600s
containers:
-
In that example main container will not start until three required service have started and are reachable over HTTP. Is this what you want to achieve?