Contact Us 1-800-596-4880

Autoscale and Add Omni Gateway Replicas to a Namespace

For high availability (HA) environments, horizontal scaling distributes load across multiple Omni Gateway instances. By default, the Helm chart for Omni Gateway is configured with one replica. To release more Omni Gateway replicas into a namespace, provide one of the following configurations:

Find the default Helm chart settings for Omni Gateway (flex-gateway) through one of the following methods:

  • Open the flex-gateway page in ArtifactHUB

  • Run helm show values <helm-repository-name>/<helm-chart-name> from a terminal window, for example, helm show values flex-gateway/flex-gateway.

Before You Begin

Ensure that the following prerequisites are in place:

Set a Replica Count

Configure and verify the number of replicas that you require. Note that new replicas replace existing replicas. If a newer version of Omni Gateway is available, the command replaces your older replica versions with the latest version.

The steps to take depend on whether a Helm chart is installed.

  1. If a Helm chart for your namespace is installed, run the following command:

    Syntax:
    helm -n <namespace> upgrade \
    <release-name> <helm-repository-name>/<helm-chart-name> \
    --reuse-values \
    --set replicaCount=<number of replicas>
    Example:
    helm -n gateway upgrade \
    ingress flex-gateway/flex-gateway \
    --reuse-values \
    --set replicaCount=2

    When successful, the command prints output similar to this example:

    Release "ingress" has been upgraded. Happy Helming!
    NAME: ingress
    LAST DEPLOYED: Mon Apr 17 15:00:09 2023
    NAMESPACE: gateway
    STATUS: deployed
    REVISION: 27
    TEST SUITE: None
  2. If the Helm chart is not installed, run the following command:

    Syntax:
    helm -n <namespace> \
    upgrade -i --create-namespace \
    <release-name> <helm-repository-name>/<helm-chart-name> \
    --set-file registration.content=<registration file> \
    --set replicaCount=<number of replicas>
    Example:
    helm -n gateway \
    upgrade -i --create-namespace \
    ingress flex-gateway/flex-gateway \
    --set-file registration.content=registration.yaml \
    --set replicaCount=2

    When successful, the command prints output similar to this example:

    Release "ingress" does not exist. Installing it now.
    NAME: ingress
    LAST DEPLOYED: Mon Apr 17 15:32:50 2023
    NAMESPACE: gateway
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
  3. Verify creation of the replicas by running the following command:

    Syntax:
    kubectl get rs -n <namespace>
    Example:
    kubectl get rs -n gateway

    When successful, the command prints output similar to this example:

    NAME                  DESIRED   CURRENT   READY   AGE
    ingress-5b7474b8f6    2         2         2       70s

Configure Autoscaling

Horizontal Pod autoscaling generates Omni Gateway replicas automatically based on CPU, memory, and other target and behavioral settings. For descriptions of these settings, see Autoscaling Parameters.

Update Your Helm Chart with an Autoscaling Configuration

To update your Helm chart with autoscaling parameters:

  1. Create a YAML file with your autoscaling configuration, modifying the settings to meet your requirements.

    Example:
    autoscaling:
      enabled: true
    This configuration file is the minimum autoscaling configuration. To configure autoscaling with more detail, see Autoscaling Parameters.
  2. If a Helm chart for your namespace is installed, run the following command to apply your autoscaling configuration:

    Syntax:
    helm -n <namespace> upgrade \
    <release-name> <helm-repository-name>/<helm-chart-name> \
    --reuse-values \
    -f <your-autoscaling-configuration-yaml>
    Example:
    helm -n gateway upgrade \
    ingress flex-gateway/flex-gateway \
    --reuse-values \
    -f autoscaling.yaml

    When successful, the command prints output similar to this example:

    Release "ingress" has been upgraded. Happy Helming!
    NAME: ingress
    LAST DEPLOYED: Tue Apr 18 15:46:38 2023
    NAMESPACE: gateway
    STATUS: deployed
    REVISION: 33
    TEST SUITE: None
  3. If the Helm chart is not installed, run the following command to apply the your autoscaling configuration:

    Syntax:
    helm -n <namespace> \
    upgrade -i --create-namespace \
    <release-name> <helm-repository-name>/<helm-chart-name> \
    --set-file registration.content=<registration file> \
    -f <your-autoscaling-configuration-yaml>
    Example:
    helm -n gateway \
    upgrade -i --create-namespace \
    ingress flex-gateway/flex-gateway \
    --set-file registration.content=registration.yaml \
    -f autoscaling.yaml

    When successful, the command prints output similar to this example:

    NAME: ingress
    LAST DEPLOYED: Tue Apr 18 15:50:29 2023
    NAMESPACE: gateway
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
  4. Verify your autoscaling configuration by running the following command:

    Syntax:
    kubectl get hpa -n <namespace>
    Example:
    kubectl get hpa -n gateway

    The command prints output similar to this example:

    NAME     REFERENCE           TARGETS          MINPODS  MAXPODS  REPLICAS  AGE
    ingress  Deployment/ingress  66%/50%, 5%/50%  2        11       2         59s

Autoscaling Parameters

To use autoscaling, enable Horizontal Pod Autoscaler (HPA), and configure other Helm chart settings to define autoscaling behavior.

Parameter Description

autoscaling.enabled

Boolean that indicates whether the Horizontal Pod Autoscaler (HPA) is enabled. Defaults to false.

autoscaling.minReplicas

The minimum number of replicas that the HPA scaler is allowed to create. Defaults to 2.

autoscaling.maxReplicas

The maximum number of replicas that the HPA scaler is allowed to create. Defaults to 11.

autoscaling.targetCPUUtilizationPercentage

A resource metric that sets the average CPU usage percentage of all deployed Pods. Defaults to 50.

autoscaling.targetMemoryUtilizationPercentage

A string representing the average memory usage percentage of all deployed Pods. Defaults to nil.

autoscaling.behavior

A setting that supports the HorizontalPodAutoscaler (HPA) object in Kubernetes. HPA settings control autoscaling behavior, such as the number of application resources based on the rate of change to the workload.

autoscaling.behavior.scaleUp, autoscaling.behavior.scaleDown

Settings for autoscaling behavior when the HPA scaler increases (scaleUp) or decreases (scaleDown) the number of replicas. Define scaling behavior with nested parameters:

  • selectPolicy: If a metric of configured resources indicates that scaling is required, this setting determines when to scale Pods. This setting is necessary because Pods can contain different numbers of replicas. Valid values are Disabled, Min, and Max. Defaults to Max. The Min and Max values indicate whether to scale Pods with the lowest (Min) or highest (Max) number of replicas.

  • stabilizationWindowSeconds: The minimum number of seconds to wait to rescale an application after a change to the workload. The goal is to prevent an overly aggressive or unstable response by HPA when scaling too frequently.

  • policies: A list of policies that determine scaling behavior:

    • type: The type of value for a given policy, 'Percent' or 'Pods'.

    • value: The value of the type for a given policy.

    • periodSeconds: The number of seconds between scaling operations for a given policy.

For more information about autoscaling, see the Kubernetes documentation.

Configure a Pod Disruption Budget

A PodDisruptionBudget limits how many Omni Gateway pods can be unavailable at the same time during voluntary disruptions, such as node drains and cluster upgrades. The Helm chart doesn’t create a PodDisruptionBudget by default.

To create a PodDisruptionBudget for the Omni Gateway Deployment:

  1. Create a YAML file with your PodDisruptionBudget configuration, for example:

    podDisruptionBudget:
      enabled: true

    By default, the PodDisruptionBudget allows at most one unavailable pod (maxUnavailable: 1).

  2. Apply the configuration with helm upgrade, as described in Update Your Helm Chart with an Autoscaling Configuration, for example:

    helm -n gateway upgrade \
    ingress flex-gateway/flex-gateway \
    --reuse-values \
    -f pdb.yaml
  3. Verify the PodDisruptionBudget:

    kubectl get pdb -n <namespace>

To keep the gateway available during a disruption, run at least two replicas. With one replica and maxUnavailable: 1, the PodDisruptionBudget allows the only pod to be evicted.

Parameter Description

podDisruptionBudget.enabled

Boolean that indicates whether the Helm chart creates a PodDisruptionBudget for the Omni Gateway Deployment. Defaults to false.

podDisruptionBudget.maxUnavailable

The maximum number of Omni Gateway pods that can be unavailable during a voluntary disruption. Defaults to 1.

For more information, see Disruptions in the Kubernetes documentation.

Configure Vertical Pod Autoscaling

A VerticalPodAutoscaler (VPA) analyzes the CPU and memory usage of the Omni Gateway container and recommends CPU and memory requests. The Helm chart doesn’t create a VerticalPodAutoscaler by default.

Before You Begin

Install the Kubernetes Vertical Pod Autoscaler in your cluster.

Create a VerticalPodAutoscaler

  1. Create a YAML file with your VerticalPodAutoscaler configuration, for example:

    verticalPodAutoscaler:
      enabled: true

    By default, the VerticalPodAutoscaler only produces recommendations (updateMode: Off) and doesn’t change the requests of running pods. Recommendations apply only to the Omni Gateway container.

  2. Apply the configuration with helm upgrade, as described in Update Your Helm Chart with an Autoscaling Configuration, for example:

    helm -n gateway upgrade \
    ingress flex-gateway/flex-gateway \
    --reuse-values \
    -f vpa.yaml
  3. View the recommendations:

    kubectl describe vpa -n <namespace>
Parameter Description

verticalPodAutoscaler.enabled

Boolean that indicates whether the Helm chart creates a VerticalPodAutoscaler for the Omni Gateway Deployment. Defaults to false.

verticalPodAutoscaler.updateMode

How the VerticalPodAutoscaler applies recommendations. Defaults to Off, which produces recommendations for CPU and memory requests without changing running pods.

For more information, see the Vertical Pod Autoscaler documentation.