Kubernetes "unable to recognize ... no matches for kind" (CRD not installed) in CI
By Daniel Zoghalchali·Latchkey
This error means kubectl tried to apply an object of a kind the cluster does not recognize. For custom resources it almost always means the CRD that defines the kind has not been installed (or not yet established) before the CR is applied.
What this error means
kubectl apply fails with unable to recognize "x.yaml": no matches for kind "Foo" in version "example.com/v1". The CR (and anything after it) does not apply.
kubectl
error: unable to recognize "release.yaml": no matches for kind
"Certificate" in version "cert-manager.io/v1"
Diagnose it: read events and previous logs
Terminal
kubectl --context "$KUBE_CONTEXT" -n "$NS" get pods -o wide
kubectl -n "$NS" describe pod <pod> | sed -n "/Events/,$p"
kubectl -n "$NS" logs <pod> --previous --tail=50
Common causes
CRD not installed
The CRD defining the kind (cert-manager, Argo, an operator) is not present in the cluster.
CRD and CR applied together / out of order
A single kubectl apply -f bundle includes both the CRD and a CR using it; the CR is processed before the CRD is established.
How to fix it
Install the CRD first
Apply CRDs, wait for them to be Established, then apply the custom resources.
Check kubectl api-resources | grep <kind> to confirm registration.
Match the CR apiVersion to the installed CRD version exactly.
Order the pipeline: CRDs -> wait Established -> CRs.
How to prevent it
Install and wait for CRDs before applying custom resources.
Keep CRDs in a separate apply phase from CRs in CI.
Pin operator/CRD versions so the CR apiVersion stays valid.
Frequently asked questions
What causes Kubernetes "unable to recognize ... no matches for kind" (CRD not installed) in CI?
There are 2 common causes: crd not installed and crd and cr applied together / out of order. The CRD defining the kind (cert-manager, Argo, an operator) is not present in the cluster.
How do I fix Kubernetes "unable to recognize ... no matches for kind" (CRD not installed) in CI?
There are 2 fixes depending on which cause you have: install the crd first and confirm the kind/version exists. Work through them in order, since the first is the most common.
What does Kubernetes "unable to recognize ... no matches for kind" (CRD not installed) in CI actually mean?
kubectl apply fails with unable to recognize "x.yaml": no matches for kind "Foo" in version "example.com/v1".
How do I stop Kubernetes "unable to recognize ... no matches for kind" (CRD not installed) in CI happening again?
Install and wait for CRDs before applying custom resources. The prevention section lists 3 changes that keep it from recurring.