Using command-line utility kubectl
we can list a custom resource instances as follows
kubectl get <customresource_kind>
In a similar fashion, do we have a REST API to achieve the same? i.e. the API takes the Kind of the CustomResource and lists all the instances created?
I am referring to this API Reference : https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/
You can list crds like every other API resources using Kubernetes REST API.
The final URL path will differ, depending on object's scope:
Cluster
orNamespaced
.The general rule for constructing the URL path is described here in official documentation.
Just to give you an example based on calico's clusterinformations.crd.projectcalico.org (v1):