클러스터에 대한 노드 풀 관리(Azure Stack HCI 23H2의 AKS)

적용 대상: Azure Stack HCI, 버전 23H2

참고

Azure Stack HCI 22H2의 AKS에서 노드 풀을 관리하는 방법에 대한 자세한 내용은 노드 풀 관리를 참조하세요.

Azure Arc에서 사용하도록 설정된 AKS에서 동일한 구성의 노드는 노드 풀로 그룹화됩니다. 이러한 노드 풀에는 애플리케이션을 실행하는 기본 VM이 포함됩니다. 이 문서에서는 AKS Arc에서 클러스터에 대한 노드 풀을 만들고 관리하는 방법을 보여 줍니다.

Kubernetes 클러스터 생성

시작하려면 단일 노드 풀을 사용하여 Kubernetes 클러스터를 만듭니다.

az aksarc create -n <cluster name> -g <resource group> --custom-location <custom location Id> --vnet-ids <vnet id> --generate-ssh-keys --load-balancer-count <load balancer count>

노드 풀 추가

명령을 사용하여 기존 클러스터에 노드 풀을 az aksarc nodepool add 추가할 수 있습니다. 노드 풀의 이름이 기존 노드 풀과 동일한 이름이 아닌지 확인합니다.

az aksarc nodepool add --name <node pool name> -g <resource group> --cluster-name <cluster name> --os-sku <Linux or Windows> --node-count <count> --node-vm-size <vm size>

노드 풀에 대한 구성 정보 가져오기

노드 풀의 구성을 보려면 다음 명령을 사용합니다 az aksarc nodepool show .

az aksarc nodepool show --cluster-name <cluster name> -n <node pool name> -g <resource group>

예제 출력:

{
"availabilityZones": null,
"count": 1,
"extendedLocation": null,
"id":
"/subscriptions/&lt;subscription&gt;/resourceGroups/edgeci-registration-rr1s46r1710&lt;resource
group&gt;/providers/Microsoft.Kubernetes/connectedClusters/&lt;cluster
name&gt;/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/&lt;nodepoolname&gt;",
"location": "westeurope",
"name": "nodepoolname",
"nodeImageVersion": null,
"osSku": "CBLMariner",
"osType": "Linux",
"provisioningState": "Succeeded",
"resourceGroup": "resourcegroup",
"status": {
  "errorMessage": null,
  "operationStatus": null,
  "readyReplicas": [
   {
    "count": 1,
    "vmSize": "Standard\_A4\_v2"
   }
  ]
},
"systemData": {
…
},
"tags": null,
"type":
"microsoft.hybridcontainerservice/provisionedclusterinstances/agentpools",
"vmSize": "Standard\_A4\_v2"
}

노드 풀에 배포된 최대 Pod 지정

클러스터를 만들 때 또는 새 노드 풀을 만들 때 노드에 배포할 수 있는 최대 Pod를 구성할 수 있습니다. 노드 풀을 만들 때 를 지정 maxPods 하지 않으면 노드 풀이 최대 110개의 Pod의 기본값으로 배포됩니다.

az aksarc nodepool add --cluster-name <cluster name> -n <node pool name> -g <resource group> --max-pods 50 --yes

노드 풀 크기 조정

노드 풀에서 노드 수를 늘리거나 축소할 수 있습니다.

노드 풀의 노드 수를 스케일링하려면 az aksarc nodepool scale 명령을 사용합니다. 다음 예제에서는 라는 nodepool1노드 풀의 노드 수를 2로 조정합니다.

az aksarc nodepool scale --cluster-name <cluster name> -n nodepool1 -g <resource group> --node-count 2 --yes

노드 풀 삭제

노드 풀을 삭제해야 하는 경우 명령을 사용합니다 az aksarc nodepool delete .

az aksarc nodepool delete --cluster-name <cluster name> -n <node pool name> -g <resource group> --yes

노드 풀에 대한 taint 또는 레이블 지정

노드 풀을 만들 때 taint 또는 레이블을 추가할 수 있습니다. taint 또는 레이블을 추가하면 해당 노드 풀 내의 모든 노드도 해당 taint 또는 레이블을 가져옵니다.

중요

를 사용하여 az aksarc nodepool전체 노드 풀의 노드에 taint 또는 레이블을 추가해야 합니다. 를 사용하여 kubectl 노드 풀의 개별 노드에 taint 또는 레이블을 적용하지 않는 것이 좋습니다.

노드 풀 taint 설정

  1. 명령을 사용하여 taint가 있는 노드 풀을 만듭니다 az aksarc nodepool add . 이름을 taintnp 지정하고 매개 변수를 --node-taints 사용하여 taint에 대해 를 지정 sku=gpu:NoSchedule 합니다.

    az aksarc nodepool add \
        --resource-group myResourceGroup \
        --cluster-name myAKSCluster \
        --name taintnp \
        --node-count 1 \
        --node-taints sku=gpu:NoSchedule \
        --no-wait
    
  2. 명령을 사용하여 노드 풀의 상태 확인합니다.az aksarc nodepool list

    az aksarc nodepool list -g myResourceGroup --cluster-name myAKSCluster
    

    다음 예제 출력은 노드 풀이 taintnp 지정된 nodeTaints를 사용하여 노드를 만드는 것을 보여 줍니다.

    [
      {
        ...
        "count": 1,
        ...
        "name": "taintnp",
        ...
        "provisioningState": "Succeeded",
        ...
        "nodeTaints":  [
          "sku=gpu:NoSchedule"
        ],
        ...
      },
     ...
    ]
    

taint 정보는 노드의 예약 규칙을 처리하기 위해 Kubernetes에 표시됩니다. Kubernetes 스케줄러는 taint 및 toleration을 사용하여 노드에서 실행할 수 있는 워크로드를 제한할 수 있습니다.

  • Taint는 노드에서 특정 Pod만 예약할 수 있음을 나타내는 노드에 적용됩니다.
  • 그런 다음, 노드의 taint를 "허용"할 수 있는 Pod에 허용 이 적용됩니다.

노드 풀 tolerations 설정

이전 단계에서는 노드 풀을 sku=gpu:NoSchedule 만들 때 taint를 적용했습니다. 다음 예제 YAML 매니페스트는 toleration을 사용하여 Kubernetes 스케줄러가 해당 노드 풀의 노드에서 NGINX Pod를 실행할 수 있도록 합니다.

  1. nginx-toleration.yaml이라는 파일을 만들고 다음 예제 YAML을 복사/붙여넣습니다.

    apiVersion: v1
    kind: Pod
    metadata:
      name: mypod
    spec:
      containers:
      - image: mcr.microsoft.com/oss/nginx/nginx:1.15.9-alpine
        name: mypod
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 1
            memory: 2G
      tolerations:
      - key: "sku"
        operator: "Equal"
        value: "gpu"
        effect: "NoSchedule"
    
  2. kubectl apply 명령을 사용하여 Pod를 예약합니다.

    kubectl apply -f nginx-toleration.yaml
    

    Pod를 예약하고 NGINX 이미지를 끌어오는 데 몇 초 정도 걸립니다.

  3. 명령을 사용하여 상태 확인합니다.kubectl describe pod

    kubectl describe pod mypod
    

    다음 압축된 예제 출력은 toleration이 sku=gpu:NoSchedule 적용되었음을 보여 줍니다. 이벤트 섹션에서 스케줄러는 노드에 Pod를 할당했습니다moc-lbeof1gn6x3.

    [...]
    Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                     node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
                     sku=gpu:NoSchedule
    Events:
      Type    Reason     Age    From                Message
      ----    ------     ----   ----                -------
      Normal  Scheduled  54s  default-scheduler   Successfully assigned default/mypod to moc-lbeof1gn6x3
      Normal  Pulling    53s  kubelet             Pulling image "mcr.microsoft.com/oss/nginx/nginx:1.15.9-alpine"
      Normal  Pulled     48s  kubelet             Successfully pulled image "mcr.microsoft.com/oss/nginx/nginx:1.15.9-alpine" in 3.025148695s (3.025157609s including waiting)
      Normal  Created    48s  kubelet             Created container
      Normal  Started    48s  kubelet             Started container
    

    이 toleration이 적용된 Pod만 의 노드에서 taintnp예약할 수 있습니다. 다른 모든 Pod는 nodepool1 노드 풀에서 예약됩니다. 더 많은 노드 풀을 만드는 경우 taint 및 tolerations를 사용하여 해당 노드 리소스에서 예약할 수 있는 Pod를 제한할 수 있습니다.

노드 풀 레이블 설정

자세한 내용은 Azure Arc 지원 AKS 클러스터에서 레이블 사용을 참조하세요. ::: zone-end

다음 단계