Deleting k8s objects stuck in finalizers

While playing around with, teardown/cleanup did not work as smoothly as I had hoped.

Specifically, I had a stuck namespace rook and customresourcedefinition This is probably due to blindly copying teardown instructions ;)

It seemed as if only these two objects were stuck, due to finalizers watching over them that were waiting on some sort of confirmation that was never going to come... This is what I ended up doing, adapted from a comment on a similar GitHub issue:

k get ns rook -o json > rook-ns.json
<edit to remove the spec.finalizers entries, leaving an empty list>
kubectl proxy --port=8080  # in another terminal
curl -H "Content-Type: application/json" -X PUT --data-binary \
  @rook-ns.json http://localhost:8080/api/v1/namespaces/rook/finalize

For the CRD, I had to GET the API until I found the right endpoint, ending up with:

k get crd -o json >
<remove the metadata.finalizers entries this time>
curl -H "Content-Type: application/json" -X PUT --data-binary \

And then of course clean up the dataDirHostPath defined in rook-cluster.yaml's Rook Cluster object on the nodes.

Oh... and Ahmet's kubectl aliases are amazingly useful!