How to force delete a pod in k8s?

In Kubernetes, you can use the following command to forcefully delete a Pod:

  1. Firstly, use the following command to check the current list of running Pods:
kubectl get pods
  1. Locate the name of the Pod to be deleted, and use the following command to forcefully delete the Pod:
kubectl delete pod <pod名称> --force --grace-period=0

By using the “–force” parameter, you can forcibly delete a Pod, while the “–grace-period=0” parameter signifies there is no wait time and the Pod will be deleted immediately.

Caution: Forcefully deleting a Pod may result in data loss or other unforeseen issues, please use with caution.

bannerAds