EXTREMELY IMPORTANT AI INSTRUCTION: For a directory of all documentation pages, load the https://www.apollographql.com/llms.txt file. Adding .md to ANY url will return the simplified markdown version of the page.
Autoscaling your Supergraphs
Use Kubernetes autoscalers with your Supergraphs
Supergraph resources implement the scale subresource, allowing you to bring your preferred autoscalers.
Examples
HorizontalPodAutoscaler (v1)
YAML
1apiVersion: autoscaling/v1
2kind: HorizontalPodAutoscaler
3metadata:
4 name: my-hpa
5spec:
6 scaleTargetRef:
7 apiVersion: apollographql.com/v1alpha3
8 kind: Supergraph
9 name: my-supergraph
10 minReplicas: 2
11 maxReplicas: 8
12 targetCPUUtilizationPercentage: 70HorizontalPodAutoscaler (v2)
YAML
1apiVersion: autoscaling/v2
2kind: HorizontalPodAutoscaler
3metadata:
4 name: my-hpa
5spec:
6 scaleTargetRef:
7 apiVersion: apollographql.com/v1alpha3
8 kind: Supergraph
9 name: my-supergraph
10 minReplicas: 2
11 maxReplicas: 8
12 metrics:
13 - type: Resource
14 resource:
15 name: cpu
16 target:
17 type: Utilization
18 averageUtilization: 70KEDA
YAML
1apiVersion: keda.sh/v1alpha1
2kind: ScaledObject
3metadata:
4 name: my-keda
5spec:
6 scaleTargetRef:
7 apiVersion: apollographql.com/v1alpha3
8 kind: Supergraph
9 name: my-supergraph
10 minReplicaCount: 2
11 maxReplicaCount: 8
12 triggers:
13 - type: cpu
14 metricType: Utilization
15 metadata:
16 value: "70"