> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmk/solutions/stale-apiservice-causing-api-discovery-failures-while-running-ku.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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 following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
