Stale APIService Causing API Discovery Failures while running kubectl

Problem

Clients such as kubectl (v1.22+), client-go, and Dynatrace components experience API discovery failures, with repeated error messages like:

kubectl
Copy

Environment

  • Platform9 Managed Kubernetes
  • kubernetes v1.23 and Higher

Cause

A stale/deprecated APIService object (v1.packages.operators.coreos.com) still exists in the cluster and references a Kubernetes Service (v1-packages-operators-coreos-com) in the pf9-olm namespace, which no longer exists. This results in a ServiceNotFound condition, which newer clients treat as a hard error during API discovery.

Resolution

Backup the APIService definition (for audit purposes):

kubectl
Copy

Delete the stale/deprecated APIService:

kubectl
Copy

Additional Information

The issue is not observed in kubectl versions older than v1.20.1 because older versions of kubectl and client-go handle unavailable or misconfigured APIService resources more gracefully—typically by logging warnings instead of failing or blocking discovery entirely.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard