How to access 3rd-party Custom Resource Definition?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Third-party Kubernetes operators often install Custom Resource Definitions, or CRDs, so they can expose domain-specific objects such as Certificate, KafkaTopic, or Prometheus. Accessing those resources is usually straightforward once you know the CRD's group, version, and plural name, but many people get stuck because they try to query them like built-in resources without first inspecting the CRD.
Find the exact resource name first
Before reading or creating a custom resource, inspect the CRD itself. That tells you the API group, supported versions, and the plural name that kubectl expects.
Inside the CRD definition, the most important fields are usually:
- '
spec.group' - '
spec.versions' - '
spec.names.kind' - '
spec.names.plural'
For example, if the CRD is certificates.cert-manager.io, then:
- the group is
cert-manager.io - the kind is
Certificate - the plural resource name is
certificates
That means kubectl queries should use the plural form, optionally with the group appended.
Query CRD instances with kubectl
Once you know the plural resource name, you can fetch objects exactly like native Kubernetes resources.
The resource may be namespaced or cluster-scoped. The CRD definition shows that under spec.scope. If the scope is Namespaced, you need -n <namespace> or -A. If the scope is Cluster, namespace flags do nothing.
You can also inspect a single object as JSON or YAML:
That is often the fastest way to understand the fields exposed by a third-party controller.
Discover CRDs from the aggregated API view
When you do not know the exact group or short name yet, kubectl api-resources is a useful discovery step because it shows the resource names that the API server currently exposes.
This is often faster than guessing a plural form from memory, especially when several third-party operators install similar-sounding resource kinds.
Create or update custom resources from manifests
Once a CRD is installed, you interact with its instances through standard manifests. The apiVersion is the CRD group plus version, and the kind matches the custom kind defined by the CRD.
Apply it with:
This is the same workflow you use for Deployments or Services. The difference is that the schema came from a third-party CRD rather than the core Kubernetes API.
Access CRDs programmatically
If you need to read CRD objects from code, use a client that supports dynamic Kubernetes resources. In Python, the official client includes a CustomObjectsApi for this case.
The important inputs are exactly the same ones you inspected from the CRD: group, version, plural, and optionally namespace.
Access control still applies
CRDs are not exempt from RBAC. You may be able to see the CRD definition itself but still be blocked from listing or reading instances. If a third-party operator installed the CRD in your cluster, confirm that your user or service account can access the resource type.
For example:
If those checks return no, the problem is permissions, not syntax.
Common Pitfalls
The most common mistake is querying the kind instead of the plural resource name. kubectl get Certificate may not behave the way you expect, while kubectl get certificates is the correct resource form.
Another issue is forgetting the API group. Short names sometimes work, but when there are collisions or aliases, using the fully qualified resource such as certificates.cert-manager.io is safer.
Namespace confusion is also common. Many custom resources are namespaced, but some are cluster-scoped. Check spec.scope in the CRD before assuming the object should be visible in a namespace.
Finally, do not assume the CRD schema from memory. Operators evolve, versions deprecate fields, and examples on the internet may refer to older API versions. Always inspect the CRD actually installed in your cluster.
Summary
- Inspect the CRD first to find its
group,version,kind, and plural name. - Use the plural resource name with
kubectl get,describe, andapply. - Read the CRD's
scopeso you know whether the resource is namespaced or cluster-scoped. - Use
CustomObjectsApior an equivalent dynamic client when accessing CRDs from code. - Check RBAC if the syntax looks correct but access still fails.
Related reading
- How to access hosts in my network from microk8s deployment pods
- How to access host's localhost from inside kubernetes cluster
- How to access key in a map returned by kubectl
- How to access Kubernetes container environment variables from React.js application?
- How to access local Kubernetes minikube dashboard remotely?
- How to access mysql outside my kubernetes cluster?
- How to access NodePort in Minikube with docker driver?
- How to access private Docker Hub repository from Kubernetes on Vagrant

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.