Skip to main content

A quick and dirty kubernetes cost estimator

Project description

skrooge

PyPI Changelog Tests License

A quick and dirty kubernetes cost estimator

OIG 0uCanRKKeLq7XwJysZQ3 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:

$ 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/activate

Now 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skrooge-1.0.1.tar.gz (171.3 kB view details)

Uploaded Source

Built Distribution

skrooge-1.0.1-py3-none-any.whl (175.9 kB view details)

Uploaded Python 3

File details

Details for the file skrooge-1.0.1.tar.gz.

File metadata

  • Download URL: skrooge-1.0.1.tar.gz
  • Upload date:
  • Size: 171.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for skrooge-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3a6f968594a6bcd1e6fd5cf26df030dc9f4c07d256f6a036ba37652ea02abad6
MD5 334d2d4a06dc43d8ffd83d222bcb1b9c
BLAKE2b-256 5598e1de4fb51dca16c1c8891f11aa1b40bdd70f9ef904efa8417dba4f0097e9

See more details on using hashes here.

File details

Details for the file skrooge-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: skrooge-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 175.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for skrooge-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e1f2538a5891d727e37e28d90f57bd0eafa1fcd13186e151d42683234ea5b26
MD5 9e492ff699bdb22a89eef108c41ca4fd
BLAKE2b-256 50c638bb11e719d4fac964777516ccbc909dbd53a81ff00f469b6e0d9325dda8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page