百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
K

kluster-capacity

> DevOps
开源

用于容量估算、调度器仿真、集群压缩、碎片化等的集群容量分析工具

193 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

用于容量估算、调度器仿真、集群压缩、碎片化等的集群容量分析工具

kluster-capacity

[中文]

Cluster capacity tool supports capacity estimation, scheduler simulation, and cluster compression. This repository was inspired by https://github.com/kubernetes-sigs/cluster-capacity.

Install

Go binaries are automatically built with each release by GoReleaser. These can be accessed on the GitHub releases page for this project.

Homebrew

This project can be installed with Homebrew:

bash
brew tap k-cloud-labs/tap
brew install k-cloud-labs/tap/kluster-capacity

Krew

This project can be installed with Krew:

bash
kubectl krew install kluster-capacity

From Source Code

Build the framework:

bash
$ cd $GOPATH/src/github.com/k-cloud-labs/
$ git clone https://github.com/k-cloud-labs/kluster-capacity
$ cd kluster-capacity
$ make build

There are three available sub-commands: ce, cc, and ss, which represent capacity estimation, cluster compression, and scheduler simulation, respectively.

Capacity Estimation

Intro

As new pods get scheduled on nodes in a cluster, more resources get consumed. Monitoring available resources in the cluster is very important as operators can increase the current resources in time before all of them get exhausted. Or, carry different steps that lead to increase of available resources.

Cluster capacity consists of capacities of individual cluster nodes. Capacity covers CPU, memory, disk space and other resources.

Overall remaining allocatable capacity is an estimation. The goal is to analyze the remaining allocatable resources and estimate the available capacity that can still be consumed in terms of the number of pod instances with given requirements that can be scheduled in a cluster.

Enhancement

Here are some enhancements to the cluster capacity mentioned above.

  • Support using an existing pod as a pod template directly from the cluster.
  • Support batch simulation for different pod templates.

Run

run the analysis:

bash
# use an specified pod yaml file as pod template
$ ./kluster-capacity ce --pods-from-template  
# use an existing pod from cluster as pod template
$ ./kluster-capacity ce --pods-from-cluster  

For more information about available options run:

bash
$ ./kluster-capacity ce --help

Demonstration

Assuming a cluster is running with 4 nodes and 1 master with each node with 2 CPUs and 4GB of memory. With pod resource requirements to be 150m of CPU and 100Mi of Memory.

…

Once the number of running pods in the cluster grows and the analysis is run again, the number of schedulable pods decreases as well:

…

Output format

ce command has a flag --output (-o) to format its output as json or yaml.

bash
$ ./kluster-capacity ce --pods-from-template  -o json|yaml

The json or yaml output is not versioned and is not guaranteed to be stable across various releases.

Scheduler Simulation

Intro

The scheduler simulation takes all nodes, pods, and other related resources in the current cluster as input to simulate the process from having no pods to creating and scheduling all pods. This can be used to calculate the cluster compression ratio to evaluate the effectiveness of the scheduling or to measure the quality of the scheduling algorithm.

Compared to cluster compression, its results are more extreme and idealized.

Run

run the analysis:

bash
 ./kluster-capacity ss

For more information about available options run:

bash
$ ./kluster-capacity ss --help

It supports two termination conditions: AllSucceed and AllScheduled. The former means the program ends when all pods are successfully scheduled, while the latter means it exits after all pods have been scheduled at least once. The default is AllSucceed. The exit condition can be set using the --exit-condition flag.

Demonstration

Assuming a cluster is running with 4 nodes and 1 master with each node with 2 CPUs and 4GB of memory. With 40 pod with resource requirements to be 100m of CPU and 200Mi of Memory to schedule.

If the scheduler uses the LeastAllocated strategy, the scheduling result may be as follows:

bash
$ ./kluster-capacity ss --verbose
Termination reason: AllSucceed: 40 pod(s) have been scheduled successfully.

Pod distribution among nodes:
        - kube-node-1: 10 instance(s)
        - kube-node-2: 10 instance(s)
        - kube-node-3: 10 instance(s)
        - kube-node-4: 10 instance(s)

Once the scheduler uses the MostAllocated strategy, the scheduling result may be as follows:

bash
$ ./kluster-capacity ss --verbose
Termination reason: AllSucceed: 40 pod(s) have been scheduled successfully.

Pod distribution among nodes:
        - kube-node-1: 20 instance(s)
        - kube-node-2: 20 instance(s)

The scheduling result above can be analyzed to evaluate the effectiveness of the scheduling strategy and the cluster capacity compression ratio. For example, the above result represents a cluster compression ratio of 2, which means that there is 50% resource waste in an ideal situation.

Cluster Compression

Intro

Cluster compression takes the current state of the cluster, including all nodes, pods, and other relevant resources, as input, and simulates the process of compressing the cluster by removing nodes. It can be used to calculate the compression ratio of the cluster, which is a measure of how efficiently the resources are being utilized.

Compared to simulation scheduling, the results of cluster compression are generally more realistic.

Run

run the analysis:

bash
 ./kluster-capacity cc --verbose

For more information about available options run:

bash
$ ./kluster-capacity cc --help

Demonstration

Assuming a cluster is running with 4 nodes and 1 master with each node with 2 CPUs and 4GB of memory. With 40 pod with resource requirements to be 100m of CPU and 200Mi of Memory bind to the 4 nodes.

bash
./kluster-capacity cc --verbose
2 node(s) in the cluster can be scaled down.

Termination reason: FailedSelectNode: could not find a node that satisfies the condition, 1 master node(s); 2 node(s) can't be scale down because of insufficient resource in other nodes;

nodes selected to be scaled down:
        - kube-node-1
        - kube-node-3

The above result indicates that with the given resource requirements for 40 pods, ensuring that all pods can be scheduled, the cluster can remove 2 additional nodes, resulting in a compression ratio of 2, which means there is 50% resource waste.

Feature

  • cluster compression
  • capacity estimation
  • scheduler simulation
  • snapshot based simulation
  • fragmentation rate analysis

Enjoy it and feel free to give your opinion, thanks!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gocapacity-planningcluster-compressionscheduler-simulator

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理