简体   繁体   中英

Is there a way to automatically restart a pod deployment if a container is unhealthy

My kubernetes cluster has a pod deployment definition to have 10 pod copies. I ran into an issue where a pod instance's container will go into an unrecoverable state where the only mitigation I found is to restart the pod deployment through the following command:

kubectl rollout restart deployment my-pod

I would like to a way to auto execute a pod deployment restart through liveness probes or even pod condition status.

Are there any current out of the box solutions for this?

Kubernetes's pod object provides you with a health check function. If the pod is unhealthy, the pod controller will automatically restart your pod.

Please check the official documentation here, https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ .

It provides all the implementations you will need in order to make the health check probe work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM