Scale OpenShift Dev Spaces for high availability
Scale OpenShift Dev Spaces for high availability by defining a Kubernetes HorizontalPodAutoscaler (HPA) resource for OpenShift Dev Spaces operands. The HPA dynamically adjusts the number of replicas based on specified metrics.
Before you begin
- You have an active
ocsession with administrative permissions to the OpenShift cluster. See This page is not included, but the link has been rewritten to point to the nearest parent document.Getting started with the CLI.
Procedure
Create an
HPA resource for a deployment, specifying the target metrics and desired replica count.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: scaler
namespace: openshift-devspaces
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: <deployment_name>
...where:
-
<deployment_name> -
One of the following deployments:
-
devspaces -
che-gateway -
devspaces-dashboard -
plugin-registry -
devfile-registryFor example:
apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: devspaces-scaler namespace: openshift-devspaces spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: devspaces minReplicas: 2 maxReplicas: 5 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 75In this example, the HPA targets the
devspacesdeployment with a minimum of 2 replicas, a maximum of 5 replicas, and scales based on CPU utilization.
-
Results
- Verify that the HPA resource is created and targeting the correct deployment:
oc get hpa -n openshift-devspaces