https://github.com/aporia-ai/kubesurvival
💰 Significantly reduce Kubernetes costs by finding the cheapest machine types that can run your workloads
https://github.com/aporia-ai/kubesurvival
aws cost-optimization domain-specific-language golang kubernetes
Last synced: about 1 year ago
JSON representation
💰 Significantly reduce Kubernetes costs by finding the cheapest machine types that can run your workloads
- Host: GitHub
- URL: https://github.com/aporia-ai/kubesurvival
- Owner: aporia-ai
- License: apache-2.0
- Created: 2021-03-23T11:45:28.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-03T09:30:26.000Z (over 4 years ago)
- Last Synced: 2024-06-18T23:00:08.646Z (about 2 years ago)
- Topics: aws, cost-optimization, domain-specific-language, golang, kubernetes
- Language: Go
- Homepage:
- Size: 50.8 KB
- Stars: 185
- Watchers: 4
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 💰 KubeSurvival
[](https://github.com/aporia-ai/kubesurvival/releases/latest)
[](https://github.com/aporia-ai/kubesurvival/actions?workflow=test)
[](https://codeclimate.com/github/aporia-ai/kubesurvival/maintainability)
[](https://codeclimate.com/github/aporia-ai/kubesurvival/test_coverage)
KubeSurvival allows you to **significantly reduce your Kubernetes compute costs** by finding the cheapest machine types that can run your workloads successfully.
If you have a multi-tenant environment, ML training jobs, a large number of ML model servers, etc, this tool can help you optimize your K8s compute costs.
To easily define workloads, KubeSurvival uses a very simple DSL:
```python
(
# Some microservice
pod(cpu: 1, memory: "1Gi") +
# Another microservice - with 3 replicas
pod(cpu: "500m", memory: "2Gi") * 3 +
# More microservices!
(
pod(cpu: 1, memory: "1Gi") +
pod(cpu: "250m", memory: "1Gi")
) * 3
) * 2 # Production, Staging
```
This will give you a result such as:
Instance type: t3.medium
Node count: 11
Total Price per Month: USD $340.45
Made with :heart: by Aporia
## Installation
Download a precompiled binary for your operating system from the [Releases](https://github.com/aporia-ai/kubesurvival/releases) page.
Alternatively, if you have Go installed, you can run:
```console
$ go install github.com/aporia-ai/kubesurvival/v2
```
## Usage
To run KubeSurvival:
./kubesurvival config.yaml
See the [examples](examples/) directory for example config files.
## How does it work?
KubeSurvival uses [k8s-cluster-simulator](https://github.com/pfnet-research/k8s-cluster-simulator) to simulate Kubernetes pod scheduling, without running on the actual underlying machines. It iterates over all possible instance types and node counts, simulates a K8s cluster with your workload, and checks if there are any pending pods.
For each simulation it calculates the on-demand cost per month using the [ec2-instances-info](https://github.com/cristim/ec2-instances-info) library. Additionally, it queries the [eni-max-pods.txt](https://github.com/awslabs/amazon-eks-ami/blob/master/files/eni-max-pods.txt) file to determine what's the maximum number of pods in each instance type.
When simulating a cluster, KubeSurvival always makes sure you have 10% free CPU and Memory on each node.
Finally, KubeSurvival selects the cheapest configuration without pending pods.
## What's missing from this?
Well... a lot actually. Here's a partial list:
* Support for AKS and GKE
* Support for calculating costs of EBS storages
* Support for different node groups (e.g 2 machines with GPU + 4 machines without GPU)
* and probably much more!
We would love your help! ❤️