Untangle kubeconfig sprawl before it breaks the next cluster switch.

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.

3 entrypoints Native CLI, Krew plugin, and PowerShell wrapper all run the same Go core.
Config-safe Preserves supported kubeconfig fields instead of rewriting partial YAML by hand.
Operator focused Backups, dry runs, and verbose output make cleanup safer in real environments.

KubeTidy exists for the moment your kubeconfig stops being trustworthy.

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.

Remove unreachable clusters without leaving dangling contexts behind

When a cluster is gone, KubeTidy also removes the users and contexts that depended on it.

Combine kubeconfig files without throwing away the fields that still matter

Keep remaining auth and cluster metadata intact while building a unified config.

Create smaller configs for support, sharing, and focused automation

Export only the contexts you want instead of distributing a full personal kubeconfig.

One product, three ways to work.

Native CLI

kubetidy

Use the Go binary directly in shells, scripts, and CI environments.

  • Best fit for Linux, macOS, and automation
  • Simple GNU-style flags
  • No PowerShell required
kubectl Plugin

kubectl kubetidy

Install through Krew to keep kubeconfig management close to your Kubernetes workflow.

  • Native plugin package
  • Fits existing kubectl habits
  • Good for cluster operators already using Krew
PowerShell

Invoke-KubeTidy

Keep existing PowerShell automation and shell usage while the implementation runs in Go underneath.

  • Same familiar command surface
  • Bundled binaries for supported platforms
  • Good migration path for existing users

What a normal KubeTidy workflow looks like.

1

Inspect the config

List clusters or contexts and confirm what is still relevant before changing anything.

2

Run cleanup with guardrails

Use backups, exclusions, and dry-run mode to control what will be removed.

3

Split or merge as needed

Export a filtered kubeconfig or merge multiple inputs into one cleaner result.

Terminal-first cleanup

Clean kubeconfig sprawl without hand-editing YAML.

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.

  • Run dry runs before deleting stale clusters or contexts.
  • Keep cleanup close to the shell, CI job, or `kubectl` workflow already in use.
  • Use the same Go core through the native CLI, Krew plugin, or PowerShell commands.
  • Export reduced kubeconfigs for support, contractors, and automation.
console
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
Best-fit workflows

Where KubeTidy pays off fastest

Start with the cleanup jobs that usually create the most manual kubeconfig churn, then let KubeTidy handle them with backups and dry-run guardrails.

Cluster fleet cleanup

Remove unreachable clusters without leaving broken contexts and users behind.

Support and contractor configs

Export smaller kubeconfigs with only the contexts someone actually needs.

Kubeconfig mergers

Combine multiple config files while preserving the metadata your teams still rely on.

Safer local admin setup

Trim stale entries before they turn into the wrong context switch during day-to-day work.

Home