Sometimes when you delete your CustomResourceDefinition (CRD) without deleting some dependencies first or your config will depend on another proces which takes place your delete action might freeze.
I had a problem setting up a knative configuration, and I had to delete a full config and create it again.
I found that my brokers.eventing.knative.dev
CRD hold and nothing could be done:
$ kubectl delete -f knative-broker.yaml
broker.eventing.knative.dev "default" deleted
...
Now to fix it:
kubectl get brokers.eventing.knative.dev -o yaml > my-resource.yaml
apiVersion: v1
items:
- apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
annotations:
eventing.knative.dev/broker.class: Kafka
creationTimestamp: "2022-07-04T09:45:23Z"
deletionGracePeriodSeconds: 0
deletionTimestamp: "2022-07-04T12:43:01Z"
finalizers:
- brokers.eventing.knative.dev
apiVersion: v1
items:
- apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
annotations:
eventing.knative.dev/broker.class: Kafka
creationTimestamp: "2022-07-04T09:45:23Z"
deletionGracePeriodSeconds: 0
deletionTimestamp: "2022-07-04T12:43:01Z"
finalizers: []
kubectl apply -f my-resource.yaml
note
In most cases you should not play with finalizers, this is for extremal situations when you are loosing hope with the situation.