k8s-pruner is a command-line tool to list and prune unused Kubernetes resources. It helps to clean up resources in a Kubernetes cluster to save costs and improve performance. This tool provides an easy-to-use interface to manage and prune resources such as Pods, ConfigMaps, Secrets, PVCs, and more.
- Clone the repository:
git clone https://github.com/manthan-parmar-1998/k8s-pruner.git
- Navigate into the project directory:
cd k8s-pruner - Run
go mod tidyto install dependencies:go mod tidy
- Build the binary:
go build -o k8s-pruner
To list unused resources:
./k8s-pruner listTo prune unused resources:
./k8s-pruner prune| Feature | k8s-pruner | kubectl-gc | KubeJanitor | Pluto | kube-cleanup-operator |
|---|---|---|---|---|---|
| CLI-based interface | ✅ | ✅ | ❌ | ✅ | ❌ |
| Prune unused ConfigMaps | ✅ | ❌ | ✅ | ❌ | ✅ |
| Prune unused Secrets | ✅ | ❌ | ✅ | ❌ | ✅ |
| Prune stale PVCs | ✅ | ❌ | ✅ | ❌ | ✅ |
| Detect & clean Jobs/Completed Pods | ✅ | ✅ | ✅ | ❌ | ✅ |
| Namespace targeting | ✅ | ❌ | Partial | ❌ | ✅ |
--dry-run support |
✅ | ❌ | ❌ | ❌ | ❌ |
--age flag |
✅ | ❌ | ✅ | ❌ | ✅ |
| Safe delete with confirmation | ✅ | ❌ | ❌ | ❌ | ❌ |
| CronJob integration | Planned | ❌ | ✅ | ❌ | ✅ |
kubectl plugin-compatible |
Planned | ❌ | ❌ | ❌ | ❌ |
| Actively maintained | ✅ | ✅ |
✅ = Fully supported | ❌ = Not supported |
⚠️ = Limited or outdated
Contributions are welcome! Please submit a pull request for any improvements or new features.
This project is licensed under the MIT License - see the LICENSE file for details.