The K8s Cost Analyzer is designed to help you calculate the cost savings when running workloads on the Control Plane platform versus running them on any cloud provider. By analyzing the resource consumption of your Kubernetes cluster.
Below is an installation guide to help you run the K8s cost analyzer.
The analyzer will require you to enter your name and email. Upon successful execution, a URL will be printed in the terminal and an email containing the result will be sent to you. Visit the URL to view the results of the cost analysis.
The K8s Cost Analyzer collects the following data:
- Your name and email address (so you can receive the cost savings estimate).
- The name and the Kubernetes version of the cluster.
- The CPU and memory usage consumption of each application running in the cluster.
- The cloud provider (e.g., AWS, GCP, etc.), type, capacity, and consumed CPU and memory of each node in the cluster.
Before you begin, ensure you have the following:
- Kubernetes CLI (kubectl) is installed on the target machine with sufficient privileges to read all objects in the desired cluster.
- Kubernetes Metrics Server is installed and healthy in the desired cluster.
There are three ways in which you can download and run the K8s cost analyzer. You can download cpln-k8s-cost-analyzer through homebrew or chocolatey or you can clone the repository and run the Python script directly. Alternatively, you can run a packaged binary from releases and execute it.
Make sure you have Homebrew installed on the target machine, for Linux you need to have Linuxbrew. Once obtained, execute the following command in your terminal:
brew tap controlplane-com/cpln && brew install cpln-k8s-cost-analyzer
Make sure you have chocolatey installed on the target machine then execute the following command in your terminal:
choco install cpln-k8s-cost-analyzer
Once downloaded successfully, run cpln-k8s-cost-analyzer
in your terminal to execute the K8s cost analyzer.
- Make sure you have python installed on the target machine, the minimum version that is needed to run the Python script is 3.6.15.
- Clone this repository:
git clone https://github.com/controlplane-com/k8s-cost-analyzer.git
- Inside the repository directory, create a virtual environment (Optional but recommended):
python -m venv venv
- If you did step 3, then activate the virtual environment:
- On Windows (Use Bash or PowerShell for this command. But, if you want to use Command Prompt, remove the dot):
. venv/Scripts/activate
- On macOS & Linux
source venv/bin/activate
- Install the required packages using pip:
pip install -r requirements.txt
- Finally, execute the
main.py
file:
python main.py
To ensure a seamless experience, we have compiled the Python script using PyInstaller, making it executable on Windows, macOS and Linux. You can easily download the executable file from the Releases section of this repository.
- Go to the Releases section.
- Download the appropriate executable file for your operating system (Windows, macOS or Linux).
- Open your terminal, navigate to the download directory and execute the following commands based on your operating system:
executable_name.exe
chmod +x ./executable_name && ./executable_name
We value community engagement and appreciate contributions to enhance this project. If you would like to contribute, please consider the following guidelines:
- Fork the repository on GitHub to create your own working copy.
- Create a new branch to isolate your changes.
- Implement your modifications, following the project's coding style and best practices.
- Thoroughly test your changes to ensure they function as intended and do not introduce any regressions.
- Submit a pull request, outlining the purpose and scope of your changes, as well as any necessary documentation updates.
- Our team will review your contribution, provide feedback if necessary, and work with you to integrate the changes into the main repository.