clean-up-crio-pods.sh 832 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. for c in $(runc list -q); do
  3. output=$(runc state $c | grep io.kubernetes.cri-o.ContainerType)
  4. if [[ "$output" =~ "container" ]]; then
  5. runc delete -f $c
  6. fi
  7. for m in $(mount | grep $c | awk '{print $3}'); do
  8. umount -R $m
  9. done
  10. done
  11. for c in $(runc list -q); do
  12. output=$(runc state $c | grep io.kubernetes.cri-o.ContainerType)
  13. if [[ "$output" =~ "sandbox" ]]; then
  14. runc delete -f $c
  15. fi
  16. for m in $(mount | grep $c | awk '{print $3}'); do
  17. umount -R $m
  18. done
  19. done
  20. mount | grep overlay | awk '{print $3}' | xargs umount | true
  21. umount -R /var/lib/containers/storage/overlay
  22. umount -R /var/lib/containers/storage
  23. rm -rf /var/run/containers/storage/*
  24. rm -rf /var/lib/containers/storage/*