explaingit

alexremn/finalizer-doctor

Analysis updated 2026-05-18

3GoAudience · ops devopsComplexity · 3/5LicenseSetup · easy

TLDR

A kubectl plugin that safely diagnoses Kubernetes resources stuck in Terminating by identifying the blocking finalizer and confirming its controller is actually gone, not just slow. Dry-run by default, requires proof before any change.

Mindmap

mindmap
  root((finalizer-doctor))
    Problem it solves
      Stuck Terminating resources
      Dead controller not detected
      Unsafe manual fixes
    How it works
      Identifies blocking finalizer
      Checks controller liveness
      Evidence-based verdict
      Dry-run by default
    Safety model
      Proof-bound confirm digest
      Re-verify before mutation
      Removes only dead finalizer
    Usage
      kubectl fid
      Cluster-wide --all scan
      JSON output for CI
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Diagnose a Kubernetes namespace stuck in Terminating and safely clear the blocking finalizer

USE CASE 2

Scan a cluster for all stuck Terminating resources to find orphaned objects with dead controllers

USE CASE 3

Add a CI step that fails the build if any resources are stuck in Terminating after a test suite run

What is it built with?

GoKuberneteskubectl

How does it compare?

alexremn/finalizer-doctorazer/diskwheredev2k6/command-code-proxy-server
Stars333
LanguageGoGoGo
Setup difficultyeasyeasyeasy
Complexity3/51/52/5
Audienceops devopsdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires kubectl and cluster access. Install via Homebrew, krew, or standalone binary.

Use freely for any purpose including commercial use, keep the license and copyright notice.

In plain English

When you delete a namespace or other resource in Kubernetes and it gets stuck in a "Terminating" state for a long time, the usual cause is a finalizer. A finalizer is a marker that tells Kubernetes to hold off on actually deleting the resource until some controller does cleanup work. If that controller has crashed or been uninstalled, nothing ever finishes the cleanup, and the resource hangs in Terminating indefinitely. The common workarounds for this problem, like manually editing the finalizer out, forcing deletion with special flags, or blindly clearing the finalizers list, all carry real risk: they can orphan actual infrastructure such as load balancers, cloud volumes, or operator-managed databases that the finalizer was protecting. The problem is that these approaches make no distinction between a controller that is completely gone versus one that is just slow or temporarily unavailable. Finalizer-doctor is a kubectl plugin that diagnoses this situation carefully. Before touching anything, it inspects the stuck resource, identifies which specific finalizer is blocking deletion, and checks whether the owning controller is actually gone rather than just slow. It only marks a finalizer as safe to clear when there is hard evidence the controller is gone. By default it runs in dry-run mode and makes no changes at all, printing a summary of what it found and what it would do. To apply changes, you pass a confirmation token that is tied to the exact state it showed you, preventing changes from being applied to a different state than the one you reviewed. Installation is available via Homebrew, krew (the kubectl plugin manager), or standalone binaries. The tool can also scan an entire cluster for all stuck resources in read-only mode, which is useful for CI checks. It is licensed under Apache 2.0.

Copy-paste prompts

Prompt 1
My Kubernetes namespace my-app-staging has been stuck in Terminating for two days. Show me how to use finalizer-doctor to diagnose it and safely clear the blocking finalizer.
Prompt 2
How does finalizer-doctor determine a controller is dead versus just slow? What evidence does it require before marking a finalizer safe to clear?
Prompt 3
I want to add finalizer-doctor to my CI pipeline to fail the build if any Terminating resources exist after tests. Write the shell commands using --all and --output json.
Prompt 4
What is the proof-bound --confirm digest in finalizer-doctor and why is it needed for --apply? How do I get the right digest to pass?

Frequently asked questions

What is finalizer-doctor?

A kubectl plugin that safely diagnoses Kubernetes resources stuck in Terminating by identifying the blocking finalizer and confirming its controller is actually gone, not just slow. Dry-run by default, requires proof before any change.

What language is finalizer-doctor written in?

Mainly Go. The stack also includes Go, Kubernetes, kubectl.

What license does finalizer-doctor use?

Use freely for any purpose including commercial use, keep the license and copyright notice.

How hard is finalizer-doctor to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is finalizer-doctor for?

Mainly ops devops.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub alexremn on gitmyhub

Verify against the repo before relying on details.