すべてのプロダクト
Search
ドキュメントセンター

Container Service for Kubernetes:アプリケーションをハイブリッドノードプールにスケジュールする

最終更新日:Mar 27, 2026

ハイブリッドクラウドノードプールを使用すると、データセンター (IDC) のノードを ACK クラスターに登録でき、オンプレミスとクラウドリソース間での統合管理と協調スケジューリングが可能になります。このトピックでは、リソースの配置場所、データローカライゼーションのコンプライアンス、または特定のハードウェアの要件を満たすために、アプリケーションをハイブリッドクラウドノードプールにスケジュールする方法について説明します。

仕組み

ハイブリッドクラウドノードプールを作成すると、ACK はプール内のすべてのノードに Taint と Label を自動的に追加します。

  • Taint: nodepool-type=hybridcloud:NoSchedule — デフォルトでは、システムコンポーネントや一般的なワークロードがハイブリッドクラウドノードに配置されるのを防ぎます。

  • Label: alibabacloud.com/nodepool-type: hybridcloud — スケジューリングポリシーがターゲットにできるように、ノードタイプをマークします。

Toleration はスケジューリング制限を解除し、Pod をハイブリッドクラウドノードの対象とします。ただし、そこに配置されることを保証するものではありません。配置を保証するには、Toleration と nodeSelector または nodeAffinity ルールを組み合わせて使用します。

アプローチの選択

アプローチ使用する場合主要な構成
許可 (ソリューション 1)総容量を拡張します。厳密な配置制約はありません。Pod は他のノードプールに配置される可能性があります。tolerations のみ
特定のノードプールをターゲットにする (ソリューション 2a)特定のハードウェア、ネットワークトポロジー、または単一のプールに対するデータレジデンシー。tolerations + nodeSelector (ノードプール ID)
任意のハイブリッドクラウドノードプールをターゲットにする (ソリューション 2b)オンプレミスで実行する必要があるが、任意の IDC ノードプールで実行できるワークロード。tolerations + nodeAffinity
プール間での優先度ベース (ソリューション 3)スケールアウトには低コストのハイブリッドクラウドプールを優先し、スケールイン時にはクラウド ECS ノードを最初に解放します。ResourcePolicy + tolerations

ソリューション 1: ハイブリッドクラウドノードへのスケジューリングを許可

使用する場合: クラスターの総容量を増やす必要があり、ワークロードに厳密な配置制約がない場合。この構成では、スケジューラはハイブリッドクラウドノードプールを有効な候補として扱いますが、Pod は他のアクティブなノードプールで実行される可能性もあります。

主要な構成: spec.template.spectolerations エントリを追加します。

spec:
  template:
    spec:
      # Allow this pod to run on hybrid cloud nodes.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"

展開して表示

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-allowed-on-hybrid
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      # Allow this pod to run on hybrid cloud nodes.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"
      containers:
        - name: nginx
          image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6
          ports:
            - containerPort: 80
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
            limits:
              cpu: "200m"
              memory: "256Mi"

ソリューション 2: ハイブリッドクラウドノードへのスケジューリングを強制

これら 2 つのサブソリューションは、どちらも Pod がハイブリッドクラウドノードに配置されることを保証します。ノードプールをどの程度正確にターゲットにする必要があるかに基づいて選択してください。

特定のノードプールをターゲットにする

使用する場合: ワークロードが特定のハイブリッドクラウドノードプールを必要とする場合 (例: 特定のハードウェア、専用のネットワークトポロジー、または厳密なデータレジデンシー要件を持つノードプール)。nodeSelector を使用して、Pod を ID で単一のノードプールに固定します。

主要な構成: spec.template.spectolerationsnodeSelector の両方を追加します。

spec:
  template:
    spec:
      # Core configuration 1: Lift the hybrid cloud scheduling restriction.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"
      # Core configuration 2: Pin to a specific node pool by ID.
      nodeSelector:
        alibabacloud.com/nodepool-id: npxxxxxxxxxxxx
クラスターの [ノード管理 > ノードプール] ページからノードプール ID を取得します。

展開して表示

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-to-nodepool
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      # Core configuration 1: Lift the hybrid cloud scheduling restriction.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"
      # Core configuration 2: Pin to a specific node pool by ID.
      nodeSelector:
        alibabacloud.com/nodepool-id: npxxxxxxxxxxxx
      containers:
        - name: nginx
          image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6
          ports:
            - containerPort: 80
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
            limits:
              cpu: "200m"
              memory: "256Mi"

任意のハイブリッドクラウドノードプールをターゲットにする

使用する場合: ワークロードがオンプレミスで実行する必要があるが、任意のハイブリッドクラウドノードプールで実行できる場合。nodeAffinityhybridcloud Label を持つすべてのノードに一致するため、Pod は 1 つに固定されるのではなく、すべての IDC ノードプールに分散されます。

主要な構成: spec.template.spectolerationsaffinity の両方を追加します。

spec:
  template:
    spec:
      # Core configuration 1: Lift the hybrid cloud scheduling restriction.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"
      # Core configuration 2: Require a hybrid cloud node by label.
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: alibabacloud.com/nodepool-type
                    operator: In
                    values:
                      - hybridcloud

展開して表示

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-to-hybrid-type
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      # Core configuration 1: Lift the hybrid cloud scheduling restriction.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"
      # Core configuration 2: Require a hybrid cloud node by label.
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: alibabacloud.com/nodepool-type
                    operator: In
                    values:
                      - hybridcloud
      containers:
        - name: nginx
          image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6
          ports:
            - containerPort: 80
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
            limits:
              cpu: "200m"
              memory: "256Mi"

ソリューション 3: ResourcePolicy を使用した優先度ベースのスケジューリング

使用する場合: 複数のノードプールがあり、順序付けされたスケールアウトと逆順のスケールインが必要な場合。たとえば、低コストのハイブリッドクラウドノードプールをプライマリプールとして使用し、クラウドベースの ECS ノードプールをオーバーフローとして使用します。

  • スケールアウト: Pod は最初にハイブリッドクラウドプールにスケジュールされます。リソースが不足している場合、ECS プールにオーバーフローします。

  • スケールイン: ECS プール内の Pod は最初に停止され、ハイブリッドクラウドプール内のリソースの安定性が維持されます。

このソリューションには、ResourcePolicy と、それを参照するワークロードの 2 つのリソースが必要です。

`ResourcePolicy` 構成: units リストでスケジューリングの優先度順を定義し、selector を使用してポリシーをターゲット Pod に関連付けます。

apiVersion: scheduling.alibabacloud.com/v1alpha1
kind: ResourcePolicy
metadata:
  name: nginx-priority-policy
spec:
  # Match pods with this label.
  selector:
    app: nginx-priority
  # The scheduler tries pools in order. First match wins.
  units:
    # Priority 1: hybrid cloud node pool (lower cost, preferred)
    - resource: ecs
      nodeSelector:
        alibabacloud.com/nodepool-id: np-pool-a-xxxxxxxxxx
    # Priority 2: ECS node pool (overflow)
    - resource: ecs
      nodeSelector:
        alibabacloud.com/nodepool-id: np-pool-b-xxxxxxxxxx
ノードプール ID は、クラスターの ノード管理 > ノードプール ページから取得します。

ワークロード構成: マッチング Label とハイブリッドクラウド Toleration を Pod テンプレートに追加します。

spec:
  template:
    metadata:
      # This label connects the pod to the ResourcePolicy above.
      labels:
        app: nginx-priority
    spec:
      # Allow scheduling to the hybrid cloud node pool.
      tolerations:
        - key: "nodepool-type"
          operator: "Equal"
          value: "hybridcloud"
          effect: "NoSchedule"
  • ResourcePolicy:

    展開して表示

    apiVersion: scheduling.alibabacloud.com/v1alpha1
    kind: ResourcePolicy
    metadata:
      name: nginx-priority-policy
      namespace: default
    spec:
      # Match pods with this label.
      selector:
        app: nginx-priority
      # The scheduler tries pools in order. First match wins.
      units:
        # Priority 1: hybrid cloud node pool (lower cost, preferred)
        - resource: ecs
          nodeSelector:
            alibabacloud.com/nodepool-id: npaxxxxxxxxxx
        # Priority 2: ECS node pool (overflow)
        - resource: ecs
          nodeSelector:
            alibabacloud.com/nodepool-id: npbxxxxxxxxxx
  • Deployment:

    展開して表示

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment-with-priority
      namespace: default
    spec:
      replicas: 5
      selector:
        matchLabels:
          app: nginx-priority
      template:
        metadata:
          # This label connects the pod to the ResourcePolicy above.
          labels:
            app: nginx-priority
        spec:
          # Allow scheduling to the hybrid cloud node pool.
          tolerations:
            - key: "nodepool-type"
              operator: "Equal"
              value: "hybridcloud"
              effect: "NoSchedule"
          containers:
            - name: nginx
              image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6
              ports:
                - containerPort: 80
              resources:
                requests:
                  cpu: "100m"
                  memory: "128Mi"
                limits:
                  cpu: "200m"
                  memory: "256Mi"

本番環境に適用

  • ハイブリッドクラウドノードプールからデフォルトの Taint nodepool-type=hybridcloud:NoSchedule を削除しないでください。この Taint は、システムコンポーネントが誤ってハイブリッドクラウドノードにスケジュールされるのを防ぎます。

  • ハイブリッドクラウドノード上のデフォルトの Label alibabacloud.com/nodepool-type: hybridcloud を削除または変更しないでください。この Label を変更または削除すると、ノードプールの正常な動作に影響を与える可能性があります。