# 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:

{% tabs %}
{% tab title="kubectl" %}

```javascript
couldn't get resource list for packages.operators.coreos.com/v1: the server is currently unable to handle the request
```

{% endtab %}
{% endtabs %}

## 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):

{% tabs %}
{% tab title="kubectl" %}

```javascript
kubectl get apiservice v1.packages.operators.coreos.com -o yaml > broken-apiservice-backup.yaml
```

{% endtab %}
{% endtabs %}

Delete the stale/deprecated APIService:

{% tabs %}
{% tab title="kubectl" %}

```javascript
kubectl delete apiservice v1.packages.operators.coreos.com
```

{% endtab %}
{% endtabs %}

## 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmk/solutions/stale-apiservice-causing-api-discovery-failures-while-running-ku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
