https://github.com/getsentry/skrooge
A quick and dirty kubernetes cost estimator
https://github.com/getsentry/skrooge
tag-non-production
Last synced: 3 months ago
JSON representation
A quick and dirty kubernetes cost estimator
- Host: GitHub
- URL: https://github.com/getsentry/skrooge
- Owner: getsentry
- License: apache-2.0
- Created: 2023-12-20T15:22:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-03T18:27:59.000Z (4 months ago)
- Last Synced: 2025-03-22T06:47:11.143Z (3 months ago)
- Topics: tag-non-production
- Language: Python
- Homepage:
- Size: 216 KB
- Stars: 5
- Watchers: 29
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# skrooge
[](https://pypi.org/project/skrooge/)
[](https://github.com/mwarkentin/skrooge/releases)
[](https://github.com/mwarkentin/skrooge/actions?query=workflow%3ATest)
[](https://github.com/mwarkentin/skrooge/blob/master/LICENSE)A quick and dirty kubernetes cost estimator

*Ebenezer scrooge standing at the helm of a ship, pencil sketch*## Idea
I've been manually calculating how much scaling kubernetes deployments up or down will cost (or save!).
It's a bit of grunt work every time pulling together our instance types, figuring out if the deployment is cpu-bound or memory-bound, and working out the cost.
Instead we could have a CLI tool (or potentially automated during CI down the road) that could calculate these numbers for us.Previous example (in english):
It would be nice to have a CLI tool which could do these calculations for us (and integrate with GCP pricing / instance APIs to get instance shapes and costs automatically)
```
Pod size: 2 cpu, 3GB RAM
Previous deployment: 32 cpu, 48GB RAM
New deployment: 64 cpu, 96GB RAM
Running on c2-standard-30 which have 30 cpu, 120GiB RAM, and cost $914/month
Up to 2 new instances to support +32 CPU, cost $1828 / month ($21,936 / year)
```How a CLI tool could work:
```bash
$ kubecost --cpu 32 --mem 48 --instance c2-standard-30
c2-standard-30: 30 cpu, 120GiB RAM, $914/month
Limiting factor: CPU (ceil(32/30) = 2)
Cost: $1828 / month ($21,936 / year)
```## Installation
Install this tool using `pip`:
pip install skrooge
## Usage
For help, run:
skrooge --help
You can also use:
python -m skrooge --help
## Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd skrooge
python -m venv venv
source venv/bin/activateNow install the dependencies, test dependencies, and GCP cost scraping dependencies:
pip install -e '.[lint,scrape,test]'
To run the tests:
pytest
To update the instances.json file:
python3 skrooge/scraper.py > skrooge/instances.json