Meet KOR : Your Kubernetes Orphaned Resources Finder
Farshad Nick (????? ??? ????)
DevOps Team Lead | 20k+ LinkedIn | Kubernetes | AWS | Terraform | Open for Collaboration
If you’ve been running Kubernetes for a while, you probably know how messy things can get. When applications come and go, they often leave behind unused or forgotten resources. These “orphans” don’t serve any purpose but still sit there, wasting space and potentially even costing you money. That’s where Kor - Kubernetes Orphaned Resources Finder comes in!
What Exactly Is Kor?
Kor is a tool designed to help you find and clean up those orphaned resources in your Kubernetes cluster. Think of it like a janitor that keeps your Kubernetes environment tidy by identifying and removing stuff you no longer need — like old PVCs (Persistent Volume Claims), ConfigMaps, Secrets, or even abandoned Services.
If you're running a busy Kubernetes cluster with tons of deployments, chances are you've got a bunch of orphaned resources sitting around. And here’s the kicker: they can actually slow down your cluster or eat up valuable resources. Kor solves that problem by tracking down those leftovers and helping you decide what to keep or toss.
Why You Need Kor
Managing Kubernetes resources can get tricky, especially when things aren’t cleaned up properly. Here’s why Kor can make your life easier:
How Kor Works
Kor operates by scanning your Kubernetes cluster and identifying any resources that no longer have any dependent objects. For example, if a PVC is sitting there without a Pod or Deployment using it, Kor will flag it as orphaned. Similarly, ConfigMaps or Secrets that no longer have references can be identified.
Kor provides a report of these resources and gives you options to remove them. It’s simple, lightweight, and efficient!
What Resources Can Kor Find?
Kor is designed to find a variety of orphaned resources, including:
How to Get Started with Kor
Kor is easy to set up and integrate with your Kubernetes environment. Once you’ve installed it, you can run it as a CronJob or a one-time scan, depending on how frequently you want to clean up.
You’ll get a detailed list of orphaned resources, and you can either manually review them or set up automated cleanups to make sure your cluster stays neat and tidy.
Installation :
For macOS users :
brew install kor
Install the binary to your $GOBIN or $GOPATH/bin:
go install github.com/yonahd/kor@latest
Kubectl plugin
kubectl krew install kor
Kor provides various subcommands to identify and list unused resources. The available commands are:
in this scenario i want to list all unused resources in default namespace
kor all -n default --show-reason
And here is the result
About Author :
Hi ??, I’m Farshad Nick (Farshad nickfetrat)
?? I regularly write articles on packops.dev and packops.ir
?? Ask me about Devops , Cloud , Kubernetes , Linux
?? How to reach me on my linkedin
Here is my Github repo
DevOps Engineer @ Amn Pardazan Kavir | DevOps, Human Communication and Interactions
6 个月Keep up the good work. Thanks for sharing ??
Site Reliability Engineer at Snapp! Box
6 个月Very helpful thanks ????
Linux system admin |DevOps engineer | Docker | Kubernetes
6 个月Great, keep it going my friend ????