Autoscaling in Kubernetes

Autoscale your DuploCloud Kubernetes deployment

Prerequisites

Before autoscaling can be configured for your Kubernetes service, make sure that:

  1. Autoscaling Group (ASG) is setup in the DuploCloud tenant

  2. Cluster Autoscaler is enabled for your DuploCloud infrastructure

Kubernetes Horizontal Pod Autoscaler (HPA)

Horizontal Pod Autoscaler (HPA) automatically scales the Deployment and its ReplicaSet. HPA checks the metrics configured in regular intervals and then scales the replicas up or down accordingly.

Configuring Services with HPA

You can configure HPA while creating a Deployment Service from the DuploCloud Portal.

  1. In the DuploCloud Portal, navigate Kubernetes -> Services, displaying the Services page.

  2. Create a new Service by clicking Add.

  3. In Add Service - Basic Options, from the Replication Strategy list box, select Horizontal Pod Scheduler.

  4. In the Horizontal Pod Autoscaler Config field, add a sample configuration, as shown below. Update the minimum/maximum Replica Count in the resource attributes, based on your requirements.

  5. Click Next to navigate to Advanced Options.

  6. In Advanced Options, in the Other Container Config field, ensure your resource attributes, such as Limits and Requests, are set to work with your HPA configuration, as in the example below.

  7. At the bottom of the Advanced Options page, click Create.

For HPA Configures Services, Replica is set as Auto in the DuploCloud Portal

When your services are running, Replicas: Auto is displayed on the Service page.

Stopping a running Kubernetes service that is using an HPA

If a Kubernetes Service is running with a Horizontal Pod AutoScaler (HPA), you cannot stop the Service by clicking Stop in the service's Actions menu in the DuploCloud Portal.

Instead, do the following to stop the service from running:

  1. In the DuploCloud Portal, navigate to Kubernetes -> Containers and select the Service you want to stop.

  2. From the Actions menu, select Edit.

  3. From the Replication Strategy list box, select Static Count.

  4. In the Replicas field, enter 0 (zero).

  5. Click Next to navigate to the Advanced Options page.

  6. Click Update to update the service.

Allowing real-time alerts for autoscaling Kubernetes nodes

When the Cluster Autoscaler flag is set and a Tenant has one or more ASGs, an unschedulable-pod alert will be delayed by five (5) minutes to allow for autoscaling. You can configure the Infrastructure settings to bypass the delay and send the alerts in real-time.

  1. From the DuploCloud portal, navigate to Administrator -> Infrastructure.

  2. Click on the Infrastructure you want to configure settings for in the Name list.

  3. Select the Settings tab.

  4. Click the Add button. The Infra - Set Custom Data pane displays.

  5. In the Setting Name list box, select Enables faults prior to autoscaling Kubernetes nodes.

  6. Set the Enable toggle switch to enable the setting.

  7. Click Set. DuploCloud will now generate faults for unschedulable K8s nodes immediately (before autoscaling).

Last updated

Logo

© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates