Skip to content

Instantly share code, notes, and snippets.

@hemanth22
Forked from ikurni/pods-stuck-in-terminating
Created December 4, 2021 13:46
Show Gist options
  • Save hemanth22/a328b5537a450fbddbb52b422ca1c8d5 to your computer and use it in GitHub Desktop.
Save hemanth22/a328b5537a450fbddbb52b422ca1c8d5 to your computer and use it in GitHub Desktop.
Delete pods stuck in terminating
### Step 1
oc delete pod <podsname> -n myproject --grace-period=0 --force
### Step 2
oc edit pod <podsname>
#Remove deletionTimestamp
#Before: deletionTimestamp: 2019-12-31T11:40:28Z
#After: deletionTimestamp: null
#Remove Finalizers
#Before
finalizers:
- foregroundDeletion
#After
finalizers: null
### Step 3
echo '{ "propagationPolicy": "Background" }' | curl -k -X DELETE -d @- -H "Authorization: Bearer Token" -H 'Accept: application/json' -H 'Content-Type: application/json' https://master.example.com:443/api/v1/namespaces/myproject/pods/my-app-123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment