yonahdissen/kor
Kubernetes Orphaned Resources Finder
50K+
Kor is a tool to discover unused Kubernetes resources. Currently, Kor can identify and list unused:
Run a container with your kubeconfig mounted:
docker run --rm -i yonahdissen/kor
docker run --rm -i -v "/path/to/.kube/config:/root/.kube/config" yonahdissen/kor all
Run as a cronjob in your Cluster (with an option for sending slack updates)
helm upgrade -i kor \
--namespace kor \
--create-namespace \
--set cronJob.enabled=true
./charts/kor
Run as a deployment in your Cluster exposing prometheus metrics
helm upgrade -i kor \
--namespace kor \
--create-namespace \
./charts/kor
For more information see in cluster usage
Kor provides various subcommands to identify and list unused resources. The available commands are:
all
- Gets all unused resources for the specified namespace or all namespaces.configmap
- Gets unused ConfigMaps for the specified namespace or all namespaces.secret
- Gets unused Secrets for the specified namespace or all namespaces.services
- Gets unused Services for the specified namespace or all namespaces.serviceaccount
- Gets unused ServiceAccounts for the specified namespace or all namespaces.deployments
- Gets unused Deployments for the specified namespace or all namespaces.statefulsets
- Gets unused StatefulSets for the specified namespace or all namespaces.role
- Gets unused Roles for the specified namespace or all namespaces.clusterrole
- Gets unused ClusterRoles for the specified namespace or all namespaces (namespace refers to RoleBinding).hpa
- Gets unused HPAs for the specified namespace or all namespaces.pods
- Gets unused Pods for the specified namespace or all namespaces.pvc
- Gets unused PVCs for the specified namespace or all namespaces.pv
- Gets unused PVs in the cluster (non namespaced resource).storageclasses
- Gets unused StorageClasses in the cluster (non namespaced resource).ingress
- Gets unused Ingresses for the specified namespace or all namespaces.pdb
- Gets unused PDBs for the specified namespace or all namespaces.crd
- Gets unused CRDs in the cluster (non namespaced resource).jobs
- Gets unused jobs for the specified namespace or all namespaces.replicasets
- Gets unused replicaSets for the specified namespace or all namespaces.daemonsets
- Gets unused DaemonSets for the specified namespace or all namespaces.finalizers
- Gets unused pending deletion resources for the specified namespace or all namespaces.exporter
- Export Prometheus metrics.version
- Print kor version information. --delete Delete unused resources
-l, --exclude-labels string Selector to filter out, Example: --exclude-labels key1=value1,key2=value2. If --include-labels is set, --exclude-labels will be ignored.
--exclude-namespaces strings Namespaces to be excluded, split by commas. Example: --exclude-namespace ns1,ns2,ns3. If --include-namespace is set, --exclude-namespaces will be ignored.
-h, --help help for kor
--include-labels string Selector to filter in, Example: --include-labels key1=value1,key2=value2.
-n, --include-namespaces strings Namespaces to run on, split by commas. Example: --include-namespace ns1,ns2,ns3.
-k, --kubeconfig string Path to kubeconfig file (optional)
--newer-than string The maximum age of the resources to be considered unused. This flag cannot be used together with older-than flag. Example: --newer-than=1h2m
--no-interactive Do not prompt for confirmation when deleting resources. Be careful using this flag!
--older-than string The minimum age of the resources to be considered unused. This flag cannot be used together with newer-than flag. Example: --older-than=1h2m
-o, --output string Output format (table, json or yaml) (default "table")
--slack-auth-token string Slack auth token to send notifications to. --slack-auth-token requires --slack-channel to be set.
--slack-channel string Slack channel to send notifications to. --slack-channel requires --slack-auth-token to be set.
--slack-webhook-url string Slack webhook URL to send notifications to
-v, --verbose Verbose output (print empty namespaces)
To use a specific subcommand, run kor [subcommand] [flags]
.
kor all --include-namespaces my-namespace
For more information about each subcommand and its available flags, you can use the --help
flag.
kor [subcommand] --help
For more information go visit: https://github.com/yonahd/kor
docker pull yonahdissen/kor