先日につづいて MIG を試したのでメモ。
今度は AKS を使って Kubernetes と MIG の組み合わせ。
やっぱ K8S で使った方が効率良い。
最初は H100 搭載の Standard_NC40ads_H100_v5 で試したが、下記のバグのため nodepool に参加出来なかったので A100 搭載の standard_nc24ads_a100_v4 で試した。
AKS cluster を CLI で作成する。 cluster に ACR もアタッチしとく。
# Create AKS cluster with ACR attached az aks create --resource-group rg-oreno \ --name orenoAKSCluster --generate-ssh-keys --location japaneast \ --attach-acr orenoacr
クラスターが出来上がったら .kube/config を作成
# Get credentials after AKS cluster is up and running az aks get-credentials --resource-group rg-oreno --name orenoAKSCluster --admin --overwrite-existing
続いて MIG ノードを作成
az aks nodepool add --name aksmignode --resource-group rg-oreno \ --cluster-name orenoAKSCluster --node-vm-size standard_nc24ads_a100_v4 \ --node-count 1 --gpu-instance-profile MIG1g
helm で AKS に Nvidia plugin をインストールする
# Install NVIDIA device plugin helm repo add nvdp https://nvidia.github.io/k8s-device-plugin helm repo update helm install nvdp nvdp/nvidia-device-plugin --version=0.17.0 --set migStrategy=mixed \ --set gfd.enabled=true --namespace nvidia-device-plugin --create-namespace
MIG ノードが出来上がったか確認。
kubectl get node
aks-aksmignode というノードが見つかるので、 describe する
kubectl describe node aks-aksmignode-12345678-vmss000000
Allocatable に nvidia.com/mig を含む項目が出てくれば OK.
Allocatable: nvidia.com/mig-1g.10gb: 7
試しに pod をスケジュールして MIG を認識してるか試す。
$ kubectl apply -f mig-test.yaml pod/mig-test created $ kubectl get pod NAME READY STATUS RESTARTS AGE mig-test 1/1 Running 0 9s $ kubectl exec mig-test -- nvidia-smi -L GPU 0: NVIDIA A100 80GB PCIe (UUID: GPU-22dd61ea-460c-05ff-9cef-ce1769e463a8) MIG 1g.10gb Device 0: (UUID: MIG-aa23f925-0631-51b1-8754-0bfb379f6e5a)
ちゃんと MIG 1g.10gb のインスタンスを認識してるので成功。
参考URL: https://learn.microsoft.com/en-us/azure/aks/gpu-multi-instance?tabs=azure-cli
Part 2 に続く