How to automatically restart all the pods in a deployment if one pod is failed

Hi, I have a requirement that I need to restart all the pods if any pod went to failed state in a deployment. I know I can run rollout restart command but I want to restart automatically, if there is any failure occurs. Anybody came across this situation or any leads will be helpful. Thank you.