Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list applied Custom Resource Definitions in kubernetes with kubectl

I recently applied this CRD file

https://raw.githubusercontent.com/jetstack/cert-manager/release-0.11/deploy/manifests/00-crds.yaml 

With kubectl apply to install this: https://hub.helm.sh/charts/jetstack/cert-manager

I think I managed to apply it successfully:

xetra11@x11-work configuration]$ kubectl apply -f ./helm-charts/certificates/00-crds.yaml --validate=false customresourcedefinition.apiextensions.k8s.io/challenges.acme.cert-manager.io created customresourcedefinition.apiextensions.k8s.io/orders.acme.cert-manager.io created customresourcedefinition.apiextensions.k8s.io/certificaterequests.cert-manager.io created customresourcedefinition.apiextensions.k8s.io/certificates.cert-manager.io created customresourcedefinition.apiextensions.k8s.io/clusterissuers.cert-manager.io created customresourcedefinition.apiextensions.k8s.io/issuers.cert-manager.io created 

But now I would like to "see" what I just applied here. I have no idea how to list those definitions or for example remove them if I think they will screw up my cluster somehow.

I was not able to find any information to that here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#preparing-to-install-a-custom-resource

like image 347
xetra11 Avatar asked Oct 22 '19 11:10

xetra11


2 Answers

kubectl get customresourcedefinitions, or kubectl get crd.

You can then use kubectl describe crd <crd_name> to get a description of the CRD. And of course kubectl get crd <crd_name> -o yaml to get the complete definition of the CRD.

To remove you can use kubectl delete crd <crd_name>.

like image 136
t3ng1l Avatar answered Sep 23 '22 00:09

t3ng1l


Custom Resources are like any other native kubernetes resources. All the basic kubecl CRUD operations works fine for CRDs. so just use any the below commands.

kubectl get crd <name of crd> kubectl describe crd <name of crd> kubectl get crd <name of crd> -o yaml  
like image 24
Abhishek Veeramalla Avatar answered Sep 21 '22 00:09

Abhishek Veeramalla