2.2.14. 既存の OpenShift Container Platform クラスターへの GPU ノードの追加


デフォルトのコンピュートマシンセット設定をコピーおよび変更して、Azure クラウドプロバイダー用の GPU 対応マシンセットとマシンを作成できます。

次の表は、検証済みのインスタンスタイプを示しています。

Expand
vmSizeNVIDIA GPU アクセラレーターGPU の最大数アーキテクチャー

Standard_NC24s_v3

V100

4

x86

Standard_NC4as_T4_v3

T4

1

x86

ND A100 v4

A100

8

x86

注記

デフォルトでは、Azure サブスクリプションには、GPU を使用する Azure インスタンスタイプのクォータがありません。お客様は、上記の Azure インスタンスファミリーのクォータの引き上げを要求する必要があります。

手順

  1. 次のコマンドを実行して、openshift-machine-api namespace に存在するマシンとマシンセットを表示します。各コンピュートマシンセットは、Azure リージョン内の異なるアベイラビリティーゾーンに関連付けられています。インストーラーは、アベイラビリティゾーン全体でコンピュートマシンの負荷を自動的に分散します。

    $ oc get machineset -n openshift-machine-api

    出力例

    NAME                              DESIRED   CURRENT   READY   AVAILABLE   AGE
    myclustername-worker-centralus1   1         1         1       1           6h9m
    myclustername-worker-centralus2   1         1         1       1           6h9m
    myclustername-worker-centralus3   1         1         1       1           6h9m

  2. 次のコマンドを実行して、既存のコンピュート MachineSet 定義のいずれかのコピーを作成し、結果を YAML ファイルに出力します。これは、GPU 対応のコンピュートマシンセット定義の基礎となります。

    $ oc get machineset -n openshift-machine-api myclustername-worker-centralus1 -o yaml > machineset-azure.yaml
  3. マシンセットの内容を表示します。

    $ cat machineset-azure.yaml

    machineset-azure.yaml ファイルの例

    apiVersion: machine.openshift.io/v1beta1
    kind: MachineSet
    metadata:
      annotations:
        machine.openshift.io/GPU: "0"
        machine.openshift.io/memoryMb: "16384"
        machine.openshift.io/vCPU: "4"
      creationTimestamp: "2023-02-06T14:08:19Z"
      generation: 1
      labels:
        machine.openshift.io/cluster-api-cluster: myclustername
        machine.openshift.io/cluster-api-machine-role: worker
        machine.openshift.io/cluster-api-machine-type: worker
      name: myclustername-worker-centralus1
      namespace: openshift-machine-api
      resourceVersion: "23601"
      uid: acd56e0c-7612-473a-ae37-8704f34b80de
    spec:
      replicas: 1
      selector:
        matchLabels:
          machine.openshift.io/cluster-api-cluster: myclustername
          machine.openshift.io/cluster-api-machineset: myclustername-worker-centralus1
      template:
        metadata:
          labels:
            machine.openshift.io/cluster-api-cluster: myclustername
            machine.openshift.io/cluster-api-machine-role: worker
            machine.openshift.io/cluster-api-machine-type: worker
            machine.openshift.io/cluster-api-machineset: myclustername-worker-centralus1
        spec:
          lifecycleHooks: {}
          metadata: {}
          providerSpec:
            value:
              acceleratedNetworking: true
              apiVersion: machine.openshift.io/v1beta1
              credentialsSecret:
                name: azure-cloud-credentials
                namespace: openshift-machine-api
              diagnostics: {}
              image:
                offer: ""
                publisher: ""
                resourceID: /resourceGroups/myclustername-rg/providers/Microsoft.Compute/galleries/gallery_myclustername_n6n4r/images/myclustername-gen2/versions/latest
                sku: ""
                version: ""
              kind: AzureMachineProviderSpec
              location: centralus
              managedIdentity: myclustername-identity
              metadata:
                creationTimestamp: null
              networkResourceGroup: myclustername-rg
              osDisk:
                diskSettings: {}
                diskSizeGB: 128
                managedDisk:
                  storageAccountType: Premium_LRS
                osType: Linux
              publicIP: false
              publicLoadBalancer: myclustername
              resourceGroup: myclustername-rg
              spotVMOptions: {}
              subnet: myclustername-worker-subnet
              userDataSecret:
                name: worker-user-data
              vmSize: Standard_D4s_v3
              vnet: myclustername-vnet
              zone: "1"
    status:
      availableReplicas: 1
      fullyLabeledReplicas: 1
      observedGeneration: 1
      readyReplicas: 1
      replicas: 1

  4. 次のコマンドを実行して、machineset-azure.yaml ファイルのコピーを作成します。

    $ cp machineset-azure.yaml machineset-azure-gpu.yaml
  5. machineset-azure-gpu.yaml の次のフィールドを更新します。

    • .metadata.namegpu を含む名前に変更します。
    • .spec.selector.matchLabels["machine.openshift.io/cluster-api-machineset"] を変更して新しい .metadata.name に一致させます。
    • .spec.template.metadata.labels["machine.openshift.io/cluster-api-machineset"] を変更して新しい .metadata.name に一致させます。
    • .spec.template.spec.providerSpec.value.vmSizeStandard_NC4as_T4_v3 に変更します。

      machineset-azure-gpu.yaml ファイルの例

      apiVersion: machine.openshift.io/v1beta1
      kind: MachineSet
      metadata:
        annotations:
          machine.openshift.io/GPU: "1"
          machine.openshift.io/memoryMb: "28672"
          machine.openshift.io/vCPU: "4"
        creationTimestamp: "2023-02-06T20:27:12Z"
        generation: 1
        labels:
          machine.openshift.io/cluster-api-cluster: myclustername
          machine.openshift.io/cluster-api-machine-role: worker
          machine.openshift.io/cluster-api-machine-type: worker
        name: myclustername-nc4ast4-gpu-worker-centralus1
        namespace: openshift-machine-api
        resourceVersion: "166285"
        uid: 4eedce7f-6a57-4abe-b529-031140f02ffa
      spec:
        replicas: 1
        selector:
          matchLabels:
            machine.openshift.io/cluster-api-cluster: myclustername
            machine.openshift.io/cluster-api-machineset: myclustername-nc4ast4-gpu-worker-centralus1
        template:
          metadata:
            labels:
              machine.openshift.io/cluster-api-cluster: myclustername
              machine.openshift.io/cluster-api-machine-role: worker
              machine.openshift.io/cluster-api-machine-type: worker
              machine.openshift.io/cluster-api-machineset: myclustername-nc4ast4-gpu-worker-centralus1
          spec:
            lifecycleHooks: {}
            metadata: {}
            providerSpec:
              value:
                acceleratedNetworking: true
                apiVersion: machine.openshift.io/v1beta1
                credentialsSecret:
                  name: azure-cloud-credentials
                  namespace: openshift-machine-api
                diagnostics: {}
                image:
                  offer: ""
                  publisher: ""
                  resourceID: /resourceGroups/myclustername-rg/providers/Microsoft.Compute/galleries/gallery_myclustername_n6n4r/images/myclustername-gen2/versions/latest
                  sku: ""
                  version: ""
                kind: AzureMachineProviderSpec
                location: centralus
                managedIdentity: myclustername-identity
                metadata:
                  creationTimestamp: null
                networkResourceGroup: myclustername-rg
                osDisk:
                  diskSettings: {}
                  diskSizeGB: 128
                  managedDisk:
                    storageAccountType: Premium_LRS
                  osType: Linux
                publicIP: false
                publicLoadBalancer: myclustername
                resourceGroup: myclustername-rg
                spotVMOptions: {}
                subnet: myclustername-worker-subnet
                userDataSecret:
                  name: worker-user-data
                vmSize: Standard_NC4as_T4_v3
                vnet: myclustername-vnet
                zone: "1"
      status:
        availableReplicas: 1
        fullyLabeledReplicas: 1
        observedGeneration: 1
        readyReplicas: 1
        replicas: 1

  6. 変更を確認するには、次のコマンドを実行して、元のコンピュート定義と新しい GPU 対応ノード定義の diff を実行します。

    $ diff machineset-azure.yaml machineset-azure-gpu.yaml

    出力例

    14c14
    <   name: myclustername-worker-centralus1
    ---
    >   name: myclustername-nc4ast4-gpu-worker-centralus1
    23c23
    <       machine.openshift.io/cluster-api-machineset: myclustername-worker-centralus1
    ---
    >       machine.openshift.io/cluster-api-machineset: myclustername-nc4ast4-gpu-worker-centralus1
    30c30
    <         machine.openshift.io/cluster-api-machineset: myclustername-worker-centralus1
    ---
    >         machine.openshift.io/cluster-api-machineset: myclustername-nc4ast4-gpu-worker-centralus1
    67c67
    <           vmSize: Standard_D4s_v3
    ---
    >           vmSize: Standard_NC4as_T4_v3

  7. 次のコマンドを実行して、定義ファイルから GPU 対応のコンピュートマシンセットを作成します。

    $ oc create -f machineset-azure-gpu.yaml

    出力例

    machineset.machine.openshift.io/myclustername-nc4ast4-gpu-worker-centralus1 created

  8. 次のコマンドを実行して、openshift-machine-api namespace に存在するマシンとマシンセットを表示します。各コンピュートマシンセットは、Azure リージョン内の異なるアベイラビリティーゾーンに関連付けられています。インストーラーは、アベイラビリティゾーン全体でコンピュートマシンの負荷を自動的に分散します。

    $ oc get machineset -n openshift-machine-api

    出力例

    NAME                                               DESIRED   CURRENT   READY   AVAILABLE   AGE
    clustername-n6n4r-nc4ast4-gpu-worker-centralus1    1         1         1       1           122m
    clustername-n6n4r-worker-centralus1                1         1         1       1           8h
    clustername-n6n4r-worker-centralus2                1         1         1       1           8h
    clustername-n6n4r-worker-centralus3                1         1         1       1           8h

  9. 次のコマンドを実行して、openshift-machine-api namespace に存在するマシンを表示します。セットごとに設定できるコンピュートマシンは 1 つだけですが、コンピュートマシンセットをスケーリングして、特定のリージョンとゾーンにノードを追加することはできます。

    $ oc get machines -n openshift-machine-api

    出力例

    NAME                                                PHASE     TYPE                   REGION      ZONE   AGE
    myclustername-master-0                              Running   Standard_D8s_v3        centralus   2      6h40m
    myclustername-master-1                              Running   Standard_D8s_v3        centralus   1      6h40m
    myclustername-master-2                              Running   Standard_D8s_v3        centralus   3      6h40m
    myclustername-nc4ast4-gpu-worker-centralus1-w9bqn   Running      centralus   1      21m
    myclustername-worker-centralus1-rbh6b               Running   Standard_D4s_v3        centralus   1      6h38m
    myclustername-worker-centralus2-dbz7w               Running   Standard_D4s_v3        centralus   2      6h38m
    myclustername-worker-centralus3-p9b8c               Running   Standard_D4s_v3        centralus   3      6h38m

  10. 次のコマンドを実行して、既存のノード、マシン、およびマシンセットを表示します。各ノードは、特定の Azure リージョンと OpenShift Container Platform ロールを持つマシン定義のインスタンスであることに注意してください。

    $ oc get nodes

    出力例

    NAME                                                STATUS   ROLES                  AGE     VERSION
    myclustername-master-0                              Ready    control-plane,master   6h39m   v1.33.4
    myclustername-master-1                              Ready    control-plane,master   6h41m   v1.33.4
    myclustername-master-2                              Ready    control-plane,master   6h39m   v1.33.4
    myclustername-nc4ast4-gpu-worker-centralus1-w9bqn   Ready    worker                 14m     v1.33.4
    myclustername-worker-centralus1-rbh6b               Ready    worker                 6h29m   v1.33.4
    myclustername-worker-centralus2-dbz7w               Ready    worker                 6h29m   v1.33.4
    myclustername-worker-centralus3-p9b8c               Ready    worker                 6h31m   v1.33.4

  11. コンピュートマシンセットのリストを表示します。

    $ oc get machineset -n openshift-machine-api

    出力例

    NAME                                   DESIRED   CURRENT   READY   AVAILABLE   AGE
    myclustername-worker-centralus1        1         1         1       1           8h
    myclustername-worker-centralus2        1         1         1       1           8h
    myclustername-worker-centralus3        1         1         1       1           8h

  12. 次のコマンドを実行して、定義ファイルから GPU 対応のコンピュートマシンセットを作成します。

    $ oc create -f machineset-azure-gpu.yaml
  13. コンピュートマシンセットのリストを表示します。

    oc get machineset -n openshift-machine-api

    出力例

    NAME                                          DESIRED   CURRENT   READY   AVAILABLE   AGE
    myclustername-nc4ast4-gpu-worker-centralus1   1         1         1       1           121m
    myclustername-worker-centralus1               1         1         1       1           8h
    myclustername-worker-centralus2               1         1         1       1           8h
    myclustername-worker-centralus3               1         1         1       1           8h

検証

  1. 次のコマンドを実行して、作成したマシンセットを表示します。

    $ oc get machineset -n openshift-machine-api | grep gpu

    MachineSet レプリカ数は 1 に設定されているため、新しい Machine オブジェクトが自動的に作成されます。

    出力例

    myclustername-nc4ast4-gpu-worker-centralus1   1         1         1       1           121m

  2. 次のコマンドを実行して、マシンセットが作成した Machine オブジェクトを表示します。

    $ oc -n openshift-machine-api get machines | grep gpu

    出力例

    myclustername-nc4ast4-gpu-worker-centralus1-w9bqn   Running   Standard_NC4as_T4_v3   centralus   1      21m

注記

ノードの namespace を指定する必要はありません。ノード定義はクラスタースコープ指定されています。

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

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

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

会社概要

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

Theme

© 2026 Red Hat
トップに戻る