APIs in Kubernetes have versions, and old beta versions disappear at some point. A manifest with a removed apiVersion can then no longer be applied – the API server doesn't know the combination of kind and version.
Symptom
k apply -f old-ingress.yaml error: resource mapping not found for name: "notes" namespace: "" from "old-ingress.yaml": no matches for kind "Ingress" in version "networking.k8s.io/v1beta1"
In the course it is an Ingress with networking.k8s.io/v1beta1. The same hits every removed version, for example autoscaling/v2beta2 for the HorizontalPodAutoscaler.
Diagnosis
Check which versions the cluster offers for the group.
k api-versions | grep -E '^(apps|autoscaling|batch|networking)' apps/v1 autoscaling/v1 autoscaling/v2 batch/v1 networking.k8s.io/v1 k explain hpa --api-version=autoscaling/v2beta2 error: couldn't find resource for "autoscaling/v2beta2, Resource=horizontalpodautoscalers"
Causes
v1beta1The API version has been removed
The cluster no longer offers the version – autoscaling/v2beta2, for example, was removed in 1.26. An old manifest still names it.
WarningStill there, but deprecated
An API that still exists but is deprecated is reported by the API server as a warning on every use. The metric apiserver_requested_deprecated_apis counts which deprecated APIs are used in the cluster.
k get --raw /metrics | grep '^apiserver_requested_deprecated_apis'
Warning: v1 Endpoints is deprecated in v1.33+; use discovery.k8s.io/v1 EndpointSlice
apiserver_requested_deprecated_apis{group="",removed_release="",resource="endpoints",
subresource="",version="v1"} 1Fix
k convert -f old-ingress.yaml --output-version networking.k8s.io/v1 > ingress.yaml
k apply -f ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
- backend:
service:
name: notes
port:
number: 80
path: /
pathType: ImplementationSpecific
ingress.networking.k8s.io/notes created
CKAD hands-on, day 15: reading pod errors, events, logs, ephemeral containers and deprecated APIs.
Go to day 15 →
FAQ
Why does k convert work?
kubectl runs programs named kubectl-* in the PATH as plugins.
Where do I see what disappears in which version?
The docs page "Deprecated API Migration Guide" lists it.