← All notes

Kubernetes finalizers - why objects stay in Terminating and how deletion completes

Answer: Finalizers are keys in metadata.finalizers that make the API server hold an object until controllers finish cleanup. They alert controllers to run specific cleanup tasks first, which gives you control over garbage collection.

Example

apiVersion: v1
kind: ConfigMap
metadata:
  name: demo
  finalizers:
  - example.com/cleanup-bucket
kubectl get pv my-volume -o jsonpath='{.metadata.finalizers}'
kubectl get pv my-volume -o jsonpath='{.metadata.deletionTimestamp}'

What happens on delete

  1. The API server adds a metadata.deletionTimestamp with the time you started the deletion.
  2. It prevents the object from being removed until all items are removed from metadata.finalizers, and returns 202 (Accepted).
  3. The controller for that finalizer notices the deletion request, satisfies its requirements, and removes its key from finalizers.
  4. When the finalizers field is emptied, the object is automatically deleted.

Rules

Common example

kubernetes.io/pv-protection prevents accidental deletion of a PersistentVolume in use by a Pod. Deleting it leaves it in Terminating until the Pod stops using it, then Kubernetes clears the finalizer and the volume is deleted.

Stuck objects

Finalizers can block the deletion of dependent objects, so an owner may remain longer than expected. Check finalizers and owner references on both objects. Avoid manually removing finalizers; only do it when the finalizer's purpose is understood and accomplished in another way.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Finalizers; kubernetes/website (GitHub), finalizers.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Finalizers; kubernetes/website (GitHub), finalizers.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.

Cite this

Permanent ID: iil:note:7531qvb3

iinventedlight. 2026. "Kubernetes finalizers - why objects stay in Terminating and how deletion completes." iinventedlight Library, iil:note:7531qvb3, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-finalizers/. License: CC-BY-4.0.

@misc{iil_note_7531qvb3,
  author = {{iinventedlight}},
  title = {{Kubernetes finalizers - why objects stay in Terminating and how deletion completes}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/kubernetes-finalizers/},
  note = {Permanent ID iil:note:7531qvb3. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-finalizers.md.