How to prevent kubernetes bring down more than 1 data node during the deployment

Not sure if this is a question for kubernetes or for elasticsearch.

We are hosting elasticsearch on kubernetes. And during the deployment, the kubernetes brings down the pods 1 by 1. But it doesn't wait for the data node to join the cluster before bringing down the next one. Similar issue for master node. Is there any way to prevent that?

Are you using ECK?

No, we are hosting/maintaining elasticsearch cluster ourselves on the kubernetes.

Ok.

Well that's definitely something that k8's would need to handle, but I am not sure on how you'd do that sorry.

The reason is k8s doesn't know what "join the cluster" means. All it knows is that the pods is running and that's the signal to bring down the next pod

Yes, that is right. Will adding the check to " readiness/startup probes" helps here? Or maybe add a "poststart lifecycle"?

Any suggestion is highly appreciated

Idk what the best answer is besides using ECK which handles it all for you.