Resolving the terminating state of pods

Sometimes if the volume path is not available, the pod might go into a Terminating state. The volume path could becomes unavailable due to one of the following reasons:

  1. IBM Spectrum Scale is not running.
  2. The file system is unmounted.
  3. The fileset is unlinked.

When a PVC is created using IBM Storage Enabler for Containers, a soft link is created between /var/lib/kubelet/pods/<pod id>/volumes/ibm~ubiquity-k8s-flex/<pv id> and the fileset link path as part of the volume mount operation.

If the fileset link path is unavailable, then the soft link becomes broken. At this stage, if a pod gets deleted, then it might go into a Terminating state for infinite period of time. Follow these step to clean up the pod which is in a Terminating state:
  1. Find the id of the pod which is in Terminating state using the following command:
    kubectl get pod --no-headers -o custom-columns=wwn:metadata.uid <pod name>
  2. Find the node on which the pod was scheduled using the following command:
     kubectl get pod --no-headers -o custom-columns=wwn:spec.nodeName <pod name>
  3. Check if a broken soft link exists on the node found in step 2 using the following command:
    ls /var/lib/kubelet/pods/<pod id>/volumes/ibm~ubiquity-k8s-flex/
  4. If the soft link is broken, then delete the soft link using the following command:
    rm /var/lib/kubelet/pods/<pod id>/volumes/ibm~ubiquity-k8s-flex/<pv id>