Bobcares

How Autoscaling Works in OVH Kubernetes Clusters

PDF Header PDF Footer

Learn how autoscaling works in OVH Kubernetes clusters. Our OVH Support team is just a click away.

How Autoscaling Works in OVH Kubernetes Clusters

How Autoscaling Works in OVH Kubernetes ClustersDid you know that autoscaling is one of Kubernetes’ most powerful advantages?

It helps us balance performance and cost-efficiency by ensuring our applications use only the required cloud resources.

This blog will explain Kubernetes autoscaling, how it helps reduce costs, and how to configure it when using a cloud provider like OVH.

What Is Kubernetes Autoscaling?

Kubernetes autoscaling automatically adjusts the resources based on real-time demand. When the application requires more CPU or RAM, the cluster scales up, and when demand drops, it scales down. This dynamic approach means we use only what’s needed. In other words, it saves us from overprovisioning and overspending.

 

If you’re coming from managing virtual machines manually (such as with KVM or Virtualizor), you’ll appreciate how Kubernetes automates these operations. This guide on setting up a KVM bridge with Virtualizor offers a solid comparison point for traditional VM management versus Kubernetes orchestration.

Suppose we are running a 24/7 service with traffic that spikes during the U.S. daytime and dips at night. Using tools like Cluster Autoscaler and Horizontal Pod Autoscaler (HPA), Kubernetes dynamically adjusts resources based on load, ensuring end-users always experience optimal performance. This prevents us from burning through the budget.

Why Autoscaling Matters: The Cost-Saving Advantage

Without autoscaling, DevOps teams must manually assign resources. This is an error-prone and inefficient process. It results in:

  • Paying for unused resources just in case traffic spikes.
  • Facing crashes and performance issues during unexpected demand surges.
  • Losing customers due to downtime or degraded performance.

Kubernetes autoscaling removes these issues and automates the process, ensuring cost-efficiency and high availability.

Manually scaling can also lead to operational challenges, especially during migrations. Here’s a deeper look at how Virtualizor users face errors during migration or cloning tasks, something Kubernetes autoscaling can help mitigate by avoiding capacity bottlenecks.

Autoscaling Methods in Kubernetes

Kubernetes supports autoscaling at both the application layer and the infrastructure layer:

  1. Horizontal Pod Autoscaler (HPA)

    Increases or decreases the number of pod replicas based on CPU usage or custom metrics.

  2. Vertical Pod Autoscaler (VPA)

    Adjusts CPU and memory requests for individual pods.

  3. Cluster Autoscaler

    Automatically adds or removes nodes from your cluster depending on scheduling needs.

Configuring Autoscaling with `kubectl`

With the Kubernetes API (via `kubectl`), we can enable and fine-tune autoscaling for our cluster.

  • List Node Pools:
    kubectl get nodepools
  • Patch a Node Pool:
    kubectl patch nodepool our_nodepool_name --type="merge" --patch='{
    "spec": {
    "autoscaling": {
    "scaleDownUnneededTimeSeconds": 900,
    "scaleDownUnreadyTimeSeconds": 1500,
    "scaleDownUtilizationThreshold": "0.7"
    }
    }
    }'
  • Check Configuration:
    kubectl get nodepool our_nodepool_name -o json | jq .spec

    The editable fields include autoscale, autoscaling, desiredNodes, minNodes, and maxNodes.

Example: Using Autoscaler with OVH Cloud

Let’s walk through setting up Kubernetes autoscaling on OVH Public Cloud.

  1. First, we have to create a cluster with Autoscaling. Go to OVH > Public Cloud > Managed Kubernetes Services and create a cluster. In step 5, enable Autoscaling before completing the setup.
  2. Then, download the kubeconfig file from OVH and export it:
    export KUBECONFIG=./kubeconfig.yml
  3. Next, verify Node pool status.
    kubectl get nodepool

    We will see autoscaling enabled with defined minimum and maximum node values.

  4. Now, create a `mongo` deployment and service:

    # mongo-service.yaml
    apiVersion: v1
    kind: Service
    metadata:
    name: mongo
    spec:
    selector:
    app: mongo
    ports:
    - protocol: TCP
    port: 27017
    # mongo-deployment.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: mongo
    spec:
    replicas: 1
    selector:
    matchLabels:
    app: mongo
    template:
    metadata:
    labels:
    app: mongo
    spec:
    containers:
    - name: mongodb
    image: mongo:5.0.6
    ports:
    - containerPort: 27017
  5. Then, apply with:
    kubectl create -f mongo-service.yaml
    kubectl create -f mongo-deployment.yaml

    We may have to update the `image` field for version changes.

  6. If we are using NGINX as the ingress controller, install it first. Then, create the ingress resource:
    kubectl create -f ams-k8s-ingress.yaml
    For environments still using bare-metal or manually configured hypervisors, you might also be interested in how to enable KVM on Ubuntu 22.04.

     

    Afterward, configure your DNS to access the app dashboard using the following command.

    kubectl get ingress

    Alternatively, if you’re exploring setting up Virtualizor environments for container or VM hosting, this guide on installing Virtualizor on AlmaLinux with command-line steps might also be helpful.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Kubernetes autoscaling is a must-have feature for any cloud-native application. It ensures that the apps always have the resources they need. Whether running mission-critical apps or handling variable loads, autoscaling delivers performance and savings.

In brief, our Support Experts demonstrated how autoscaling works in OVH Kubernetes clusters.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF