Pages

Topics

Tools

↑↓navigate↵openescclose
All guides

no matches for kind in version: removed APIs and missing CRDs

kubectl cannot map the manifest to an endpoint. Either the API version was removed or the CRD is absent, and discovery tells you which.

~4 min readKubernetes
#Kubernetes#CRD#API#kubectl
A kubectl manifest crate rejected at a cyan API discovery gate, an amber CRD slot empty beside it

Introduction & Quick Summary

text
error: resource mapping not found for name: "web" namespace: "prod" from "deploy.yaml": no matches for kind "Deployment" in version "extensions/v1beta1" ensure CRDs are installed first

The API server's discovery data has no resource type at that group and version, so kubectl cannot map your document to an endpoint. Nothing was applied; the only side effect is a nonzero exit code.

Two families of cause, and the message tells you which:

  • The API version was removed. extensions/v1beta1 for Ingress, batch/v1beta1 for CronJob, policy/v1beta1 for PodSecurityPolicy and autoscaling/v2beta2 all reached end of life. The fix is a manifest edit, not a cluster change.
  • The custom resource definition is missing. The kind exists in your CRD but not in the cluster, because the CRD was never applied, was applied to another context, or was applied in the same kubectl apply -f . pass that contains the custom resources.

The hints in the message matter:

Message fragmentMeaningAction
no matches for kind ... in version ...Group/version not servedCheck kubectl api-resources
ensure CRDs are installed firstCRD-dependent kindApply CRDs, wait for Established
unable to recognize "file.yaml"Older kubectl wording, same causeSame
the server could not find the requested resourceWrong path or dead API groupCheck discovery, then the version
no matches for kind but the kind works elsewhereWrong kubeconfig contextkubectl config current-context

Core Mechanics, Signatures & Reproducible Setup

kubectl resolves a kind through discovery: group, version, resource, and whether the resource is namespaced. Discovery is served from /api for the core group and /apis for everything else, and it is cached in ~/.kube/cache for ten minutes. A CRD appears in discovery only after its Established condition is true, which is why applying CRDs and custom resources in one directory can fail on a fast cluster.

Inspect what the cluster actually serves:

bash
kubectl api-resources --api-group=apps kubectl api-versions | sort kubectl explain ingress.spec --api-version=networking.k8s.io/v1 | head -20

Reproduce the deprecated API case without a cluster by validating a manifest:

# ingress-old.yaml apiVersion: extensions/v1beta1 kind: Ingress metadata: name: web spec: backend: serviceName: web servicePort: 80
bash
kubectl apply --dry-run=server -f ingress-old.yaml # error: resource mapping not found ... no matches for kind "Ingress" in version "extensions/v1beta1"

The current equivalent changes both the version and the shape, because backend was replaced by defaultBackend and pathType became required:

apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: web spec: defaultBackend: service: name: web port: number: 80 rules: - host: app.example.com http: paths: - path: / pathType: Prefix backend: service: name: web port: number: 80

For CRD ordering, split the apply and wait for establishment:

bash
kubectl apply -f crds/ kubectl wait --for condition=established --timeout=60s crd/certificates.cert-manager.io kubectl apply -f resources/

Key Comparison Table

API group/versionKindRemoved inReplacement
extensions/v1beta1Ingress1.22networking.k8s.io/v1
batch/v1beta1CronJob1.25batch/v1
policy/v1beta1PodSecurityPolicy1.25Pod Security Admission
autoscaling/v2beta2HorizontalPodAutoscaler1.26autoscaling/v2
flowcontrol.apiserver.k8s.io/v1beta2FlowSchema1.29v1beta3 or v1
cert-manager.io/v1alpha2CertificateCRD-dependentcert-manager.io/v1
CheckCommandWhat it proves
Cluster serves the versionkubectl api-versionsGroup/version exists
Kind exists in that versionkubectl api-resources --api-group=<g>Resource mapping exists
CRD is installedkubectl get crd <plural>.<group>Object exists
CRD is readykubectl wait --for condition=establishedDiscovery will include it
Manifest matcheskubectl apply --dry-run=serverServer accepts it without mutating

Practical Edge Cases, Error Fixes & Deep Dive Code Examples

Case 1: A Helm chart that ships CRDs in the wrong folder

Helm installs crds/ before templates, but crds/ files are not upgraded and are never templated. A chart that puts CRDs under templates/ races its own custom resources. Keep crds/ for the definitions and guard the resource with a capability check:

{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1" }} apiVersion: cert-manager.io/v1 kind: Certificate {{- end }}

Case 2: Metrics API missing after a fresh install

text
error: unable to fetch metrics from resource metrics API: the server could not find the requested resource

metrics.k8s.io is an aggregated API served by metrics-server. If kubectl api-resources lacks it, install metrics-server and wait for the APIService to become available:

bash
kubectl get apiservice v1beta1.metrics.k8s.io -o yaml | grep -A3 conditions

Case 3: Two contexts, one manifest

A CRD applied in staging is absent in prod. Verify the context before debugging the YAML:

KUBECONFIG=~/.kube/prod kubectl config current-context KUBECONFIG=~/.kube/prod kubectl get crd | grep example.com

kubectl config view --minify -o jsonpath='{..namespace}' also reveals whether a namespace default is causing a misleading "not found" on namespaced resources.

Case 4: Aggregated API that is registered but unhealthy

An APIService object can exist while its backing service has no ready endpoint, so discovery omits the group entirely. Look for False availability:

bash
kubectl get apiservice -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.conditions[?(@.type=="Available")].status}{"\n"}{end}' | grep False

Case 5: A CRD schema that rejects the version at admission

Once the version is served, the next failure is usually validation. Dry-run on the server so schema errors surface before the real apply:

bash
kubectl apply --dry-run=server -f resource.yaml -o yaml | head -40

--dry-run=client only checks what kubectl can see locally and cannot validate CRD schemas, which is why it passes on manifests the server rejects.

Case 6: Server-Side Apply and field manager conflicts

After switching to kubectl apply --server-side, a removed field can reappear from another manager's field set, and a kind mismatch can look like a version problem. Inspect ownership:

bash
kubectl get deployment web -o yaml --show-managed-fields | grep -A2 managedFields

Common Compilation/Runtime Mistakes & Version Gotchas

  • kubectl skew. A kubectl older than the cluster can lack discovery hints for new versions, while a much newer one drops old API handling. Keep within one minor version of the control plane.
  • Discovery cache. After installing a CRD, kubectl can still report no match for up to ten minutes. Delete ~/.kube/cache or use --cache-dir=/tmp/fresh when in doubt.
  • apiVersion casing. apps/V1 and Networking.k8s.io/v1 are not valid; the group is lowercase and the version starts with v.
  • kustomize patches silently dropping fields. A strategic merge patch written against extensions/v1beta1 leaves an apiVersion older than the base, and the error then points at the generated output. Render first with kubectl kustomize . | head.
  • Cluster upgrades. Managed clusters jump minors at once, removing several API versions in a single step. Run kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis before an upgrade to count real usage.
  • Offline validation. Tools that validate against a bundled schema rather than a live cluster will accept versions your cluster does not serve. Prefer --dry-run=server in CI against a real ephemeral cluster.

When the failing object is the CRD itself and the schema is huge, extract the spec.versions block and clean it up with the YAML viewer to spot an inconsistent served, storage or schema combination. If an API version change implies a payload change, compare the old and new manifests with the diff tool before applying. For verifying that the API server is reachable at all, the curl generator can build an authenticated request against /apis to see the raw discovery document.

Primary references: the Kubernetes deprecated API migration guide lists removals per release, and Custom Resource Definitions documents served, storage and establishment conditions.

Official references

primary documentation

The Kubernetes documentation that defines the behaviour this guide explains.

Try matching browser tools

All tools

Small utilities that fit Kubernetes work — they run entirely in this browser tab, so nothing you paste leaves your device.

All Kubernetes guides

More in Kubernetes

All Kubernetes guides

The guides filed next to this one in Kubernetes, in library order.