Scale Che for high availability
Scale Che for high availability by defining a Kubernetes HorizontalPodAutoscaler (HPA) resource for Che operands. The HPA dynamically adjusts the number of replicas based on specified metrics.
Procedure
-
Create an
HPAresource for a deployment, specifying the target metrics and desired replica count.apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: scaler namespace: eclipse-che spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: <deployment_name> ...where:
<deployment_name>-
One of the following deployments:
-
che -
che-gateway -
che-dashboard -
plugin-registry -
devfile-registryFor example:
apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: che-scaler namespace: eclipse-che spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: che minReplicas: 2 maxReplicas: 5 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 75In this example, the HPA targets the
chedeployment with a minimum of 2 replicas, a maximum of 5 replicas, and scales based on CPU utilization.
-
Verification
-
Verify that the HPA resource is created and targeting the correct deployment:
kubectl get hpa -n eclipse-che
Additional resources