[go: up one dir, main page]

Skip to content

Cleaner is a Kubernetes controller that identifies unused or unhealthy resources, helping you maintain a streamlined and efficient Kubernetes cluster. It provides flexible scheduling, label filtering, Lua-based selection criteria, resource removal or update and notifications via Slack, Webex and Discord. it can also automate clusters operations.

License

Notifications You must be signed in to change notification settings

gianlucam76/k8s-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Go Report Card Docker Pulls Slack License Twitter Follow

All Contributors

The Kubernetes controller Cleaner identifies, removes, or updates stale/orphaned or unhealthy resources to maintain a clean and efficient Kubernetes cluster. It is designed to handle any Kubernetes resource types (including your own custom resources) and provides sophisticated filtering capabilities, including label-based selection and custom Lua-based criteria. Cleaner can also be used to identify unhealthy resources.

k8s-cleaner keeps you in the loop with handy notifications through:

  1. Slack Slack
  2. Webex Webex
  3. Discord Discord
  4. Teams Teams
  5. SMTP SMTP
  6. reports

Each notification contains list of all resources successfully deleted (or modified) by k8s-cleaner. Choose what works best for you!

Currently k8s-cleaner has rich set of working examples to identify and list unused:

There are also examples to identify unhealthy resources:

Features and Capabilities

1️⃣ Schedule: Specify the frequency at which the k8s-cleaner should scan the cluster and identify stale resources. Utilise the Cron syntax to define recurring schedules.

2️⃣ DryRun: Enable safe testing of the k8s-cleaner filtering logic without affecting actual resource configurations. Resources matching the criteria will get identified, but no changes will get applied.

3️⃣ Label Filtering: Select resources based on user-defined labels, filtering out unwanted or outdated components. Refine the selection based on label key, operation (equal, different, etc.), and value.

4️⃣ Lua-based Selection Criteria: Leverage the Lua scripting language to create complex and dynamic selection criteria, catering to specific resource management needs. Define custom logic to identify and handle stale resources. To validate the Cleaner configuration, have a look here.

5️⃣ Notifications: Stay informed! The k8s-cleaner keeps users in the loop about every cleaned-up resource, whether removed or optimized. Get detailed notification lists and pick your preferred channel: Slack, Webex, Discord, Teams, SMTP or reports.

For a complete list of features with examples, have a look at the link.

Benefits

💪 Resource Removal: Efficiently remove stale resources from your cluster, reclaiming unused resources and improving resource utilisation.

💪 Resource Updates: Update outdated resources to ensure they align with the latest configurations and maintain consistent functionality.

💪 Reduced Resource Bloat: Minimize resource bloat and maintain a clean and organized cluster, improving overall performance and stability.

By combining the flexibility of scheduling, the accuracy of label filtering, the power of Lua-based criteria, and the ability to remove or update stale resources, the k8s-cleaner empowers users to effectively manage Kubernetes environments and optimise resource usage.

How to work with us

  • 👉 For feature requests and bugs, file an issue.
  • 👉 To get updates ⭐️ star this repository.
  • 👉 Working examples can be found in the examples section.

Getting Started Guide

Validate Cleaner Configuration

To verify the correctness of the Cleaner configuration, follow the comprehensive instructions provided in the documentation: here and here.

In essence, the Cleaner YAML file alongside the YAML files representing matching and non-matching resources need to get provided, and then by executing the simple make ut command the resutls will appear. This will validate whether your configuration correctly identifies and manages the desired resources.

Contribute

We encourage everyone to contribute to the example directory by adding new Cleaner configurations 💡. This will help the community benefit from different expertise and build a stronger knowledge base of the Cleaner use cases.

To add an example, simply create a new file in the example directory with a descriptive name and put your Cleaner configuration within the file. Once you've added your example, feel free to submit a pull request to share it with the community.

🤝 Together we can expand the range of Cleaner applications and make it an even more valuable tool for managing Kubernetes resources efficiently.

Code of Conduct

This project adheres to the CNCF Code of Conduct

By participating, you are expected to honor this code.

Contributors

Gianluca Mardente
Gianluca Mardente

💻
Oliver Bähler
Oliver Bähler

💻
Eleni Grosdouli
Eleni Grosdouli

📖
Colin J Lacy
Colin J Lacy

💻
Amin Mohammadian
Amin Mohammadian

📖

About

Cleaner is a Kubernetes controller that identifies unused or unhealthy resources, helping you maintain a streamlined and efficient Kubernetes cluster. It provides flexible scheduling, label filtering, Lua-based selection criteria, resource removal or update and notifications via Slack, Webex and Discord. it can also automate clusters operations.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project