KubeTidy keeps Kubernetes access sane by removing unreachable clusters, cleaning the users and contexts tied to them, merging config files safely, and exporting smaller kubeconfigs when you need something focused and shareable.
Large kubeconfig files collect stale clusters, broken auth entries, and temporary contexts that outlive the environment they came from.
KubeTidy gives you a faster and safer way to clean that up than hand-editing YAML or hoping kubectl config is enough.
When a cluster is gone, KubeTidy also removes the users and contexts that depended on it.
Keep remaining auth and cluster metadata intact while building a unified config.
Export only the contexts you want instead of distributing a full personal kubeconfig.
kubetidyUse the Go binary directly in shells, scripts, and CI environments.
kubectl kubetidyInstall through Krew to keep kubeconfig management close to your Kubernetes workflow.
kubectl habitsInvoke-KubeTidyKeep existing PowerShell automation and shell usage while the implementation runs in Go underneath.
List clusters or contexts and confirm what is still relevant before changing anything.
Use backups, exclusions, and dry-run mode to control what will be removed.
Export a filtered kubeconfig or merge multiple inputs into one cleaner result.
KubeTidy gives operators a safer terminal-native workflow for inspecting stale clusters, running cleanup with guardrails, and exporting smaller configs when they need something focused and shareable.
kubetidy@kubedeck $ kubetidy --kubeconfig ~/.kube/config --dryrun --verbose
Dry run enabled: Skipping backup of the KubeConfig file.
Checking reachability for cluster: aks-prod
Checking reachability for cluster: old-sandbox
Dry run enabled: The following clusters would be removed: old-sandbox
Start with the cleanup jobs that usually create the most manual kubeconfig churn, then let KubeTidy handle them with backups and dry-run guardrails.
Remove unreachable clusters without leaving broken contexts and users behind.
Export smaller kubeconfigs with only the contexts someone actually needs.
Combine multiple config files while preserving the metadata your teams still rely on.
Trim stale entries before they turn into the wrong context switch during day-to-day work.