Enabling autoscaling of gateway pods

Enable autoscaling of gateway pods to ensure high availability of DataPower pods.

Autoscaling enables the gateway deployment to scale dynamically, either vertically or horizontally.

It is not possible to use both horizontal and vertical pod scaling simultaneously. You must configure either HPA (for horizontal scaling) or VPA (for vertical scaling) as scaling method.

  • To enable HPA, add the following fields to the CR:

    In OpenShift or Cloud Pak for Integration, add the fields to the spec.gateway section of the API Connect Cluster CR.

      podAutoScaling:
        hpa:
          maxReplicas: 5
          minReplicas: 3
          targetCPUUtilizationPercentage: 90
          targetMemoryUtilizationPercentage: 80
        method: HPA
    
  • To enable VPA, add the following fields to the CR:

    In OpenShift or Cloud Pak for Integration, add the fields to the spec.gateway section of the API Connect Cluster CR.

      podAutoScaling:
        method: VPA
        vpa:
          maxAllowedCPU: 4 
          maxAllowedMemory: 16G
    

Note that the values shown in the CR entries are just examples.

Table 1. Autoscaling configuration settings
Setting Description
method Specifies either Horizontal Pod Autoscaling or Vertical Pod Autoscaling

Value must be either HPA or VPA.

To disable autoscaling, leave method blank or omit the podAutoScaling: section from the CR.

maxReplicas HPA. Maximum pods that can be scaled up to by the horizontal pod autoscaler. Must be a value greater than minReplicas.
minReplicas HPA. Minimum pods that can be scaled down to by the horizontal pod autoscaler.
targetCPUUtilizationPercentage: HPA. Percent threshold on average CPU usage by pods for triggering horizontal scaling.
targetMemoryUtilizationPercentage HPA. Percent threshold on average memory usage by pods for triggering horizontal scaling.
maxAllowedCPU VPA. Maximum value for CPU resource that can be assigned to a DataPower container when scaling vertically. Minimum value is set from DataPowerRequestsSpec.ResourceCPU
maxAllowedMemory VPA. Maximum amount of memory that can be assigned to a DataPower container when scaling vertically. Minimum value is set from DataPowerRequestsSpec.ResourceMemory
Note:

DataPower Gateway supports long-lived connections such as such as GraphQL subscriptions or other websockets connections. These long-lived connections might not be preserved when pods are scaled down based on defined CPU or memory thresholds. Workloads with long-lived connections are more vulnerable to failed API transactions when auto-scaling is occurring.

To learn more about HPA and VPA autoscaling, see