☁️ Kubernetes Auto Scale on Huawei Cloud CCE Service

Rabia Yılmaz
Huawei Developers
Published in
6 min readApr 5, 2024
Kubernetes Autoscale

Introduction

👀 Kubernetes is a widely adopted container management platform, particularly favored for deploying and managing modern applications in cloud environments. However, the traffic and load patterns of applications often fluctuate over time. In such cases, Kubernetes’ autoscaling feature enables applications to dynamically respond to their demands. Huawei Cloud’s Container Cluster Engine (CCE) service provides an ideal platform for running Kubernetes swiftly and flexibly in a cloud infrastructure. This article explains how Kubernetes autoscaling can be utilized on Huawei Cloud CCE and enables applications to dynamically respond to their requirements.

AutoScale Add-on 🫧

Huawei Cloud Container Cluster Engine (CCE) offers several add-ons to enhance the functionality and capabilities of Kubernetes clusters deployed on the Huawei Cloud platform.

Autoscaling add-ons enable dynamic scaling of Kubernetes clusters based on resource usage metrics such as CPU and memory utilization or custom metrics. This ensures that clusters can automatically scale up or down to meet the demands of applications running on them.

These add-ons and integrations enhance the functionality, security, performance, and scalability of Kubernetes clusters deployed on Huawei Cloud CCE, providing users with a comprehensive platform for running containerized workloads in the cloud. The specific add-ons available may vary based on the configuration and offerings of Huawei Cloud CCE.

Autoscale Hands-On 🧠

Pre-requirements:

  1. Huawei Cloud Account
  2. Huawei Cloud CCE Service

After the cluster creation, we need to install an add-on on the console. Follow the below image for add-on installation.

Huawei Cloud CCE AutoScale Add-On

Install by default values.

Scale Up ⬆️

Cluster scale-up is a fundamental operation in Kubernetes infrastructure management, involving expanding a Kubernetes cluster’s capacity to meet the evolving needs of applications and services hosted within it. When the existing resources of a Kubernetes cluster become insufficient to handle increased workload demands, or when there’s a requirement for enhanced performance, resilience, or redundancy, cluster scale-up becomes necessary.

The process of cluster scale-up typically entails several steps. First, there’s an assessment of the current resource utilization and performance metrics to determine the need for scaling up. This assessment considers factors such as CPU and memory usage, network throughput, and storage capacity.

Once the need for scale-up is identified, additional worker nodes are provisioned and added to the cluster. These worker nodes are essentially the servers or virtual machines responsible for running containerized applications. The provisioning of new nodes can be done manually or automatically, depending on the scaling strategy and the capabilities of the infrastructure provisioning tools in use.

After the new worker nodes are added, the Kubernetes cluster needs to be reconfigured to recognize and utilize these nodes effectively. This involves tasks such as updating the cluster configuration, redistributing workloads across the new nodes, and ensuring that networking and storage configurations are updated accordingly. Kubernetes’ built-in mechanisms for resource management and scheduling help distribute the workload evenly across the expanded cluster.

Following the scale-up operation, it’s crucial to validate the changes and monitor the cluster’s performance closely. This ensures that the additional resources are effectively utilized and that the desired improvements in workload capacity, performance, and resilience are achieved. Monitoring tools and metrics provided by Kubernetes, along with external monitoring solutions, can be leveraged to track resource usage, application performance, and cluster health post-scale-up.

In summary, cluster scale-up in Kubernetes involves expanding the cluster’s capacity by adding more worker nodes to meet growing workload demands and enhance performance. It’s a critical aspect of Kubernetes infrastructure management, enabling clusters to adapt dynamically to changing resource requirements and ensuring the continued efficient operation of applications and services.

Let’s learn and try on Huawei Cloud Console.

  1. After the add-on is installed, we open the autoscale setting of the node pool from the nodes page.
Node pool autoscale

2. You can change the following settings as you wish and make your scale configurations.

Autoscale configuration

3. Before Autoscale, there were two nodes in the pool.

Node pool autoscale

4. By increasing the number of pods of any workload and ensuring that the nodes are insufficient, we ensure that autoscale is triggered. the triggered autoscale node adds a new node to the pool.

Triggered autoscale
Triggered autoscale

5. The system continues to add nodes to the cluster according to the request size.

Huawei Cloud AutoScale

Scale Down ⬇️

Kubernetes scale-down refers to reducing the size of a Kubernetes cluster by removing resources, typically worker nodes when they are no longer needed to support the current workload. This optimization helps minimize costs, optimize resource utilization, and ensure efficient cluster operation. Kubernetes continuously monitors resource usage within the cluster and identifies idle or underutilized resources that can be safely removed. Before decommissioning resources, Kubernetes ensures that any running workloads are gracefully terminated or migrated to other nodes. Once confirmed, Kubernetes proceeds with removing the identified resources from the cluster. This process helps organizations maintain an optimal balance between resource availability and cost efficiency in their Kubernetes environments.

Clusters may not always have the same degree of load. In cases where the load decreases, the number of nodes needs to decrease for cost.

  1. Reducing the number of nodes is not a default feature. To activate it, go to the auto scale tab on the settings page and scroll down the page.
Autoscale Down

2. Let’s change the Scale settings as we wish and test by reducing the load on the cluster.

Scale down configuration

3. Let’s reduce the face in workloads and wait for autoscale to trigger. Last time there were 5 nodes in the cluster.

Huawei Cloud AutoScale down

4. We can see that the nodes are deleted one by one with the triggered autoscale. In the picture below, we can see that the nodes are deleted one by one from the cluster as a result of the triggering.

Huawei cloud Autoscale down

5. We also see that a different node was deleted due to a drop in the request rate

Huawei cloud Autoscale down

Conclusion 👩🏼‍💻

The autoscaling feature of Kubernetes on Huawei Cloud CCE allows applications to swiftly and effectively respond to variable traffic and load conditions. This feature ensures optimal application performance while efficiently utilizing resources. By instantly adapting to fluctuations in workload demands, autoscaling enhances user experience and optimizes operational costs. The Huawei Cloud CCE service, combining the power and flexibility of Kubernetes with autoscaling capabilities, significantly enhances the management and performance of cloud-based applications.

--

--