Deployment and Operations

2 mins read

Configuring Cloudentity Pods Autoscaling to Match Increased/Decreased Demand

Learn how to configure autoscaling of base Cloudentity pods and worker pods.

Autoscaling in a Nutshell

Kubernetes workload resources (such as the Cloudentity platform deployment) can be automatically scaled to match demand based on custom metrics, multiple metrics, or metric APIs. For example, increased load may result in additional pods being deployed. On the other hand, if the load decreases, the workload resources is scaled back down.

Cloudentity Helm Chart provides support for the HorizontalPodAutoscaler resource. Metrics Server must be used to expose Cloudentity resources usage metrics used by autoscaling.

More on autoscaling details can be found in the Horizontal Pod Autoscaler K8s documentation.


  • Kubernetes cluster v1.16+
  • Kubernetes Metrics Server
  • Helm v3.0+
  • Resource requests specified in the Helm chart

Configure Autoscaling

Autoscaling can be enabled for base Cloudentity pods as well as worker pods. The configuration parameters are identical, although worker pods configuration is located under workers key in values.yaml.

For autoscaling to work properly, resource requests must be set for the Cloudentity pods.

    cpu: 500m
    memory: 1.2Gi

To enable autoscaling integration, set the autoscaling.enabled parameter to true.

When autoscaling is enabled, the replicaCount parameter is ignored.

  • autoscaling.minReplicas parameter is used to set the minimum number of replicas.
  • autoscaling.maxReplicas parameter is used to set the maximum number of replicas.
  • autoscaling.targetCPUUtilizationPercentage parameter can be used to enable CPU autoscaling at a given percentage.
  • autoscaling.targetMemoryUtilizationPercentage parameter can be used to enable memory autoscaling at a given percentage.
  • behavior parameter can be used to configure detailed scaling behaviors
  ## If true, autoscaling is enabled
  enabled: true

  ## Set a minimum number of 3 replicas
  minReplicas: 3

  ## Set a maximum number of 9 replicas
  maxReplicas: 9

  ## Enable CPU autoscaling at 70% of request utilization
  targetCPUUtilizationPercentage: 70

  ## Enable memory autoscaling at 50% of request utilization
  targetMemoryUtilizationPercentage: 50

  ## Consider utilization values from last 5 minutes during scaling
  ## Scale Down one pod at a time every 180 seconds
      stabilizationWindowSeconds: 300
        - type: Pods
          value: 1
          periodSeconds: 180
  • Autoscaling works based on the average usage across all Cloudentity pods for given metric.
  • Average value of 100% for the metric is defined in resources.requests.
  • CPU and Memory autoscaling can work at the same time. Scaling works on metric which reports the higher desired count.
  • The default upscale delay equals 0s (controlled by cluster operator in kube-controller-manager)
  • The default downscale delay equals 5m (controlled by cluster operator in kube-controller-manager)
  • Metrics scrape interval can be configured in metric-server via the metric-resolution (default 60s)
  • The default scale up bahavior is to add 100% of currently running replicas or 4 pods (whichever is higher) every 15 seconds based on last metric
  • The default scale down bahavior is to remove up to 100% of currently running replicas every 15 seconds based on 5 minutes of metrics
Updated: Jul 28, 2022