このコンテンツは選択した言語では利用できません。

Chapter 8. Configure autoscaling


Configure autoscaling for OpenShift Dev Spaces container replicas and for cluster nodes running workspaces.

8.1. Configure replicas for OpenShift Dev Spaces containers

Define a Kubernetes HorizontalPodAutoscaler (HPA) resource for OpenShift Dev Spaces operands to ensure high availability and handle varying workloads. The HPA dynamically adjusts the number of replicas based on specified metrics.

Prerequisites

Procedure

  1. 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-registry

      For 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: 75

      In this example, the HPA targets the devspaces deployment 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:

    oc get hpa -n openshift-devspaces

8.2. Configure machine autoscaling

Configure OpenShift Dev Spaces startup timeouts and pod annotations to work with the cluster autoscaler, preventing workspace disruptions when nodes are added or removed.

When the autoscaler adds a new node, workspace startup can take longer than usual until node provisioning is complete. When the autoscaler removes a node, workspace pods should not be evicted because eviction can cause interruptions and loss of unsaved data.

Prerequisites

  • You have an active oc session with administrative permissions to the destination OpenShift cluster. See Getting started with the CLI.
  • You have the cluster autoscaler enabled on the OpenShift cluster.

Procedure

  1. Set the startup timeout and event handling in the CheCluster Custom Resource to handle autoscaler node additions:

    spec:
      devEnvironments:
        startTimeoutSeconds: 600
        ignoredUnrecoverableEvents:
          - FailedScheduling

    where:

    startTimeoutSeconds
    Set to at least 600 seconds to allow time for a new node to be provisioned during workspace startup.
    ignoredUnrecoverableEvents
    Ignore the FailedScheduling event to allow workspace startup to continue when a new node is provisioned. This setting is enabled by default.
  2. Add the safe-to-evict annotation to the CheCluster Custom Resource to prevent workspace pod eviction when the autoscaler removes a node:

    spec:
      devEnvironments:
        workspacesPodAnnotations:
          cluster-autoscaler.kubernetes.io/safe-to-evict: "false"

Verification

  • Start a workspace and verify that the workspace pod contains the cluster-autoscaler.kubernetes.io/safe-to-evict: "false" annotation:

    $ oc get pod <workspace_pod_name> -o jsonpath='{.metadata.annotations.cluster-autoscaler\.kubernetes\.io/safe-to-evict}'
    false
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る