Skip to main content
logoTetrate Service BridgeVersion: 1.12.x

Scaling Tetrate Gateways

By default, Tetrate gateways provide HPA (Horizontal Pod Autoscaler) configuration. This allows Kubernetes HPA to scale gateway pods based on CPU or memory utilization.

HPA may be disabled for a gateway, allowing other scaling methods such as KEDA to be used instead.

HPA Configuration

Horizontal Pod Autoscaler automatically scales the number of pods in a deployment based on a specified metric. Kubernetes periodically adjusts the number of replicas in a deployment to match the observed metric to the target specified.

This mirrors the Kubernetes spec, except that the top-level scaleTargetRef field need not be set. The version of Horizontal Pod Autoscaler currently used is v2beta1.

If not specified, a default HPA with maxReplicas as 10 and 70% average CPU utilisation is created.

Example

The following example illustrates how to apply a custom hpaSpec configuration to a Gateway Install resource:

apiVersion: install.tetrate.io/v1alpha1
kind: Gateway
metadata:
name: my-gw
namespace: my-ns
spec:
kubeSpec:
service:
type: LoadBalancer
annotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
deployment:
hpaSpec:
minReplicas: 2
maxReplicas: 8
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50

You can apply hpaSpec configuration to the Management Plane InstallGatewayTemplate resource in a similar manner, to control gateways that are automatically deployed by the TSB Management Plane as needed.

Refer to the Tetrate HorizontalPodAutoscalerSpec and Kubernetes HPA documentation for full details.

Using Alternate Autoscalers

You can use alternative autoscaling solutions, such as KEDA. Before doing so, you should disable HPA as the solutions will likely conflict:

spec:
kubeSpec:
deployment:
hpaSpec:
disabled: true