Search code examples
kubernetesmicrok8s

Auto restart pod after out of space for ephemeral-storage


In case of lack of disk space the pod will get to status containerStatusUnknow, When describe the pod it seems that it

Status: Failed
Reason: Evicted
message: The node was low on resource: ephemeral-storage.....

Is there a way in microk8s to check for free disk space every few minutes and restart the pod in case the node got free disk space?


Solution

  • ...check for free disk space every few minutes

    kubelet is doing this.

    ...restart the pod in case the node got free disk space?

    Use Deployment/Statefulset kind to manage your pod will have your pod automatically start on next available node. Eg. when the disk pressure is cleared, or you start a new node, or exiting pod has completed and the node is ready to accept new deployment.