Skip to content
Latchkey

kubectl "the server could not find the requested resource" in CI

This NotFound is about the API endpoint, not a named object. kubectl asked for a resource path the API server does not serve - usually a removed/renamed API version or a kubectl too far out of step with the cluster version.

What this error means

A command fails with Error from server (NotFound): the server could not find the requested resource. It differs from "<name>" not found: here the whole resource endpoint is unavailable, often after a cluster upgrade.

kubectl output
Error from server (NotFound): the server could not find the requested resource

Common causes

Removed or renamed API version

A cluster upgrade dropped an old API (e.g. a */v1beta1 endpoint), so a manifest or command targeting it no longer resolves to a served path.

Client/server version skew

A kubectl far newer or older than the cluster requests paths the server does not expose. Kubernetes supports only ±1 minor of skew.

Stale discovery cache

kubectl’s cached API discovery under ~/.kube/cache is out of date after a CRD/API change, so it requests a path that is no longer there.

How to fix it

Check version skew and served APIs

Terminal
kubectl version --output=yaml | grep -E 'gitVersion'
kubectl api-versions

Align kubectl and refresh discovery

  1. Use a kubectl within one minor version of the cluster.
  2. Update manifests/commands to an API version the cluster serves.
  3. Clear the discovery cache if it is stale: rm -rf ~/.kube/cache.

How to prevent it

  • Pin a kubectl version matched to the cluster’s minor version in CI.
  • Track API deprecations (pluto, kubectl convert) before cluster upgrades.
  • Refresh kubectl discovery after API/CRD changes.

Frequently asked questions

What causes ""could not find the requested resource""?
A cluster upgrade dropped an old API (e.g. a */v1beta1 endpoint), so a manifest or command targeting it no longer resolves to a served path.
How do I fix "could not find the requested resource"?
Check version skew and served APIs

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card