Bootstrap FreeKB - OpenShift - Delete Custom Resource Definitions (CRD) using the oc delete crd command
OpenShift - Delete Custom Resource Definitions (CRD) using the oc delete crd command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get customresourcedefinitions (or just oc get crd) command can be used to list your Custom Resource Definitions (CRDs).

~]$ oc get customresourcedefinitions
NAME                                                              CREATED AT
alertmanagerconfigs.monitoring.coreos.com                         2022-02-02T14:12:44Z
alertmanagers.monitoring.coreos.com                               2020-09-30T15:47:27Z
apirequestcounts.apiserver.openshift.io                           2022-07-12T12:10:42Z
apiservers.config.openshift.io                                    2020-09-30T15:40:14Z
authentications.config.openshift.io                               2020-09-30T15:40:14Z
authentications.operator.openshift.io                             2020-09-30T15:40:41Z
baremetalhosts.metal3.io                                          2020-09-30T15:41:05Z
bmceventsubscriptions.metal3.io                                   2022-10-05T10:01:02Z
builds.config.openshift.io                                        2020-09-30T15:40:14Z

 

The oc delete customresourcedefinitions (or just oc delete crd) command can then be used to delete a Custom Resource Definition.

oc delete crd servicemeshrbacconfigs.rbac.maistra.io

 

If the Custom Resource Definition remains, you may need to remove finalizers from the Custom Resource Definition. For example, to delete the kialis.kiali.io Custom Resource Definition, I had to use the oc edit command and remove the customresourcecleanup.apiextensions.k8s.io finalizer. Once the finalizer was removed, the Custom Resource Definition was no longer listed.

~]$ oc get customresourcedefinition kialis.kiali.io --output yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  creationTimestamp: "2021-04-15T20:01:30Z"
  deletionGracePeriodSeconds: 0
  deletionTimestamp: "2022-09-16T15:42:35Z"
  finalizers:
  - customresourcecleanup.apiextensions.k8s.io

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter e0b0da in the box below so that we can be sure you are a human.