Sizing Cluster Kubernetes

Ayi angio
Easyread
Published in
2 min readJul 4, 2021

--

Photo by Cameron Venti on Unsplash

Creating Kubernetes Cluster, there are several things to consider, such as determine the cluster environment (on-premise or cloud), hardware specifications for each node, and calculating storage if needed.

The purpose of cluster sizing is monthly cost planning and performance.

However, in reality, the cluster grows up according to the number of services in the cluster or scaling up the resources for each service.

In this post, I will explain how to calculate the size of the cluster according to our needs. I will try to do sizing with the following study case.

Study Case

A company has a plan to migrate to Kubernetes that runs in the cloud, the company has a microservice architecture that totals 100 services. All those services have used a helm chart.

Type.Csv

From the 100 services, I group into 4 types according to the average resource needed, then determine the minimum maximum replication. In this case, I set the minimum replication is 2 and the maximum replication is 4 for all services type. I will get the table below

Workload Calculation
  • Initial Resources are the limit of CPU and memory for each type of service
  • Min/Max is the replication of all the pods
  • Total (Max) CPU/Memory is the result of

(Max Replication * Initial Resource Request) * Total Service

and I get a total of 70 Cores and 235 GB of Memory needed to run all pods.

Next, calculate Cluster sizing with the reference type machine provided by Google Cloud Platform and you can see here.

Result

Node Calculation

In the table, there are 3 nodes. To calculate the total number of CPU Cores and Memory :

  • 32 * 3 = 96 CPU Cores
  • 120 * 3 = 360 GB Memory

The maximum usage of resources is 75% to prevent a decrease in performance. To calculate the maximum usage, I define the formula below :

RoundUp((Request Resource / (Specifications * Total Nodes)) * 100)

So, I choose the machine type n1-standard-32 because it’s more efficient for resource usage and operational costs.

Conclusion

You can calculate resources with several approaches. Those are just simple formulas based on experience and not exact formulas.

Thank you, Have a nice day.

Reference

--

--