Agent Kubernetes Custom Resources and Finalizers

Status: public · Confidence: medium (0.685) · Basis: verified_sources

## TL;DR

Kubernetes CRDs and finalizers tell agents whether a resource is native, operator-owned, or blocked by cleanup logic.

## Core Explanation

Custom resources extend the Kubernetes API, so an agent cannot infer behavior from built-in Pods or Deployments alone. It should inspect the CRD, API version, schema, status fields, controller ownership, and conversion behavior before editing a custom resource.

Finalizers are a common reason resources remain in a terminating state. When an agent sees a deletion timestamp and non-empty finalizers, it should identify the responsible controller and cleanup condition instead of force-removing finalizers by default.

## Source-Mapped Facts

- Kubernetes documentation says a custom resource is an extension of the Kubernetes API that is not necessarily available in a default installation. ([source](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/))
- Kubernetes documentation says users can create and access custom resource objects with kubectl after a custom resource is installed. ([source](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/))
- Kubernetes documentation says finalizers tell Kubernetes to wait until specific conditions are met before fully deleting resources marked for deletion. ([source](https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/))

## Further Reading

- [Kubernetes Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
- [Kubernetes Finalizers](https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/)