Skip to content

gaurav-cicd/container-cleanup-and-cost-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<<<<<<< HEAD

container-cleanup-and-cost-management

=======

Container Cleanup and Cost Management

This project provides automated solutions for container resource management and cost optimization in Kubernetes and Docker environments.

Features

1. Orphaned Container Cleanup

  • Identifies and removes unused Docker images, containers, and volumes
  • Configurable retention policies
  • Safe cleanup with dry-run option

2. EKS Cost Optimization

  • Automated scaling of non-production clusters
  • AWS Lambda integration for scheduled scaling
  • Configurable scaling rules and thresholds

3. Container Log Rotation

  • Automated log management using Fluentd
  • Configurable retention policies
  • Elasticsearch integration for log storage

Project Structure

.
├── README.md
├── requirements.txt
├── docker_cleanup/
│   ├── __init__.py
│   └── cleanup.py
├── eks_optimization/
│   ├── __init__.py
│   └── scaling.py
└── log_management/
    ├── __init__.py
    ├── fluentd.conf
    └── log_rotation.py

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Configure AWS credentials:
aws configure
  1. Set up Fluentd (if using log management):
# Install Fluentd
brew install fluentd

Usage

Docker Cleanup

python docker_cleanup/cleanup.py --dry-run

EKS Scaling

python eks_optimization/scaling.py --cluster-name my-cluster --scale-down

Log Rotation

python log_management/log_rotation.py --retention-days 30

Configuration

Each component can be configured through environment variables or configuration files:

  • DOCKER_CLEANUP_RETENTION_DAYS: Number of days to retain Docker resources
  • EKS_SCALING_SCHEDULE: Cron expression for scaling schedule
  • LOG_RETENTION_DAYS: Number of days to retain logs

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT License

042d81b (Initial commit)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages