{"id":13522521,"url":"https://github.com/xcoulon/kubectl-terminate","last_synced_at":"2026-01-12T02:39:17.304Z","repository":{"id":47245791,"uuid":"219845224","full_name":"xcoulon/kubectl-terminate","owner":"xcoulon","description":"kubectl-terminate, a kubectl plugin to remove finalizers and finally delete k8s resources","archived":false,"fork":false,"pushed_at":"2021-10-08T09:49:45.000Z","size":86,"stargazers_count":33,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-02T06:14:10.311Z","etag":null,"topics":["cli","kubectl-plugins","kubernetes","openshift"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xcoulon.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-05T20:33:46.000Z","updated_at":"2024-04-09T08:05:56.000Z","dependencies_parsed_at":"2022-08-28T16:50:33.750Z","dependency_job_id":null,"html_url":"https://github.com/xcoulon/kubectl-terminate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcoulon%2Fkubectl-terminate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcoulon%2Fkubectl-terminate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcoulon%2Fkubectl-terminate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcoulon%2Fkubectl-terminate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xcoulon","download_url":"https://codeload.github.com/xcoulon/kubectl-terminate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222683219,"owners_count":17022462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","kubectl-plugins","kubernetes","openshift"],"created_at":"2024-08-01T06:00:48.398Z","updated_at":"2026-01-12T02:39:17.280Z","avatar_url":"https://github.com/xcoulon.png","language":"Go","funding_links":[],"categories":["kubectl Plugins"],"sub_categories":["Installing plugins via awesome-kubectl-plugins"],"readme":"= kubectl-terminate\n\nimage:https://godoc.org/github.com/xcoulon/kubectl-terminate?status.svg[\"GoDoc\", link=\"https://godoc.org/github.com/xcoulon/kubectl-terminate\"]\nimage:https://goreportcard.com/badge/github.com/xcoulon/kubectl-terminate[\"Go Report Card\", link=\"https://goreportcard.com/report/github.com/xcoulon/kubectl-terminate\"]\nimage:https://github.com/xcoulon/kubectl-terminate/workflows/CI/badge.svg[\"CI\", link=\"https://github.com/xcoulon/kubectl-terminate/actions?query=workflow%3ACI\"]\nimage:https://codecov.io/gh/xcoulon/kubectl-terminate/branch/master/graph/badge.svg[\"Codecov\", link=\"https://codecov.io/gh/xcoulon/kubectl-terminate\"]\nimage:https://img.shields.io/badge/License-Apache%202.0-blue.svg[\"License\", link=\"https://opensource.org/licenses/Apache-2.0\"]\n\nWARNING:: *Use at your own risk!*\n\nSometimes (hopefully on your dev cluster) you may find yourself with a namespace stuck in `Terminating` phase because one of its child resource has a finalizer, but the operator (or controller) in charge of dealing with this finalizer is already gone (for example, it has been uninstalled). This is quite annoying and sadly the `--force`, `grace-period`, etc. flags won't help. The only way to get rid of the resource is to PATCH it in order to remove the finalizers, then delete it. Doing it with a good old `curl` command is possible, but let's admit it, it's a bit cumbersome 😬\n\nSay hello to `kubectl-terminate` 👋 \n\nThis command takes care of removing the finalizers and deleting the resource on your behalf, using the connection settings of your choice, i.e, using the `KUBECONFIG` env var if it exists, the `--kubeconfig` flag if specified or the default location (`$HOME` on Linux and macOS and `%USERPROFILE%` on Windows). \n\nAnd since its name follows the `kubectl-*` pattern, it also works as a plugin for `kubectl` and `oc` (for OpenShift 4 users). Just make sure that the binary is in your `$PATH` and use it with `kubectl terminate pod/cheesecake` or `oc terminate pod/cheesecake` 🎉\n\n== Installation\n\n- run `go install github.com/xcoulon/kubectl-terminate/cmd` and add `$GOPAH/bin` to `$PATH` or move `$GOPAtH/bin/kubectl-terminate` in one of the directories of `$PATH`\n- clone this repository, run `make install` and add `$GOPAH/bin` to `$PATH` or move `$GOPAtH/bin/kubectl-terminate` in one of the directories of `$PATH`\n\n== Demo\n\nOn your own Kubernetes or OpenShift cluster, you can try it with the following commands:\n\n[source,bash]\n----\n# create 2 pods called `keep-me` and `delete-me` that don't do anything\n$ kubectl run --image radial/busyboxplus --restart=Never keep-me -- sleep 3600\npod/delete-me created\n\n$ kubectl run --image radial/busyboxplus --restart=Never delete-me -- sleep 3600\npod/delete-me created\n\n# patch the `delete-me` pod by adding a custom finalizer\n$ kubectl patch pod/delete-me -p '{\"metadata\":{\"finalizers\":[\"demo/block-me\"]}}'\npod/delete-me patched\n\n# try to delete it with the regular `delete` command\n$ kubectl delete pod/delete-me\npod \"delete-me\" deleted\n^C\n\n# ... but the command blocks and the pod still exists\n$ kubectl get pods\nNAME        READY   STATUS        RESTARTS   AGE\ndelete-me   0/1     Terminating   0          51s\nkeep-me     1/1     Running       0          54s\n\n# delete it with the `terminate` command\n$ kubectl terminate pod/delete-me\npod \"delete-me\" terminated\n\n# verify \n$ kubectl get pods   \nNAME      READY   STATUS    RESTARTS   AGE\nkeep-me   1/1     Running   0          82s\n----\n\n== Contribution\n\nFeel free to open https://github.com/kubernetes-sigs/krew-index/issues[issues] if you find bugs or require more features. Also, PRs are welcome if you're in the mood for that 🙌\n\n== License\n\nThis code is licensed under the https://github.com/xcoulon/kubectl-terminate/blob/master/LICENSE[Apache License, version 2.0].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcoulon%2Fkubectl-terminate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcoulon%2Fkubectl-terminate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcoulon%2Fkubectl-terminate/lists"}