다음을 통해 공유


PDB로 인한 제거 오류로 인한 UpgradeFailed 오류 문제 해결

이 문서에서는 AKS(Azure Kubernetes Service) 클러스터를 업그레이드하려고 할 때 발생하는 PDB(Pod 중단 예산)로 인한 제거 오류로 인해 UpgradeFailed 오류를 식별하고 해결하는 방법을 설명합니다.

필수 조건

이 문서에는 Azure CLI 버전 2.67.0 이상이 필요합니다. 버전 번호를 찾으려면 .를 실행 az --version합니다. Azure CLI를 설치하거나 업그레이드해야 하는 경우 Azure CLI를 설치하는 방법을 참조하세요.

업그레이드 프로세스에 대한 자세한 내용은 AKS(Azure Kubernetes Service) 클러스터 업그레이드의 "AKS 클러스터 업그레이드" 섹션을 참조하세요.

증상

다음 오류 메시지 중 하나로 AKS 클러스터 업그레이드 작업이 실패합니다.

  • (UpgradeFailed) 너무 많은 요청 오류로 Pod <pod-name> 를 제거하지 못한 경우 드레이닝 node aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx 에 실패했습니다. 이는 종종 제한적인 PDB(Pod 중단 예산) 정책으로 인해 발생합니다. https://aka.ms/aks/debugdrainfailures을 참조하세요. 원래 오류: Pod의 중단 예산을 위반하기 때문에 Pod를 제거할 수 없습니다. PDB 디버그 정보: <namespace>/<pod-name> 0개의 준비되지 않은 Pod가 있는 pdb <pdb-name> 에 의해 차단됩니다.

  • 코드: UpgradeFailed
    메시지: 너무 많은 요청 오류로 Pod <pod-name> 를 제거하지 못한 경우 드레이닝 노드 aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx 가 실패했습니다. 이는 종종 제한적인 PDB(Pod 중단 예산) 정책으로 인해 발생합니다. https://aka.ms/aks/debugdrainfailures을 참조하세요. 원래 오류: Pod의 중단 예산을 위반하기 때문에 Pod를 제거할 수 없습니다. PDB 디버그 정보: <namespace>/<pod-name> 0개의 준비되지 않은 Pod가 있는 pdb <pdb-name> 에 의해 차단됩니다.

원인

이 오류는 Pod가 PDB(Pod 중단 예산) 정책으로 보호되는 경우에 발생할 수 있습니다. 이 경우 Pod는 드레이닝되지 않으며, 여러 번의 시도 후에 업그레이드 작업이 실패하고 클러스터/노드 풀이 Failed 상태가 됩니다.

PDB 구성: ALLOWED DISRUPTIONS 값을 확인합니다. 값은 더 커야 합니다 1 . 자세한 내용은 Pod 중단 예산을 사용하여 가용성 계획을 참조 하세요. 예를 들어 다음과 같이 워크로드 및 해당 PDB를 확인할 수 있습니다. 열이 중단을 ALLOWED DISRUPTIONS 허용하지 않는 것을 관찰해야 합니다. 값이 ALLOWED DISRUPTIONS0Pod가 제거되지 않고 업그레이드 프로세스 중에 노드 드레이닝이 실패합니다.

$ kubectl get deployments.apps nginx
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
nginx   2/2     2            2           62s

$ kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
nginx-7854ff8877-gbr4m   1/1     Running   0          68s
nginx-7854ff8877-gnltd   1/1     Running   0          68s

$ kubectl get pdb
NAME        MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
nginx-pdb   2               N/A               0                     24s

명령을 kubectl get events | grep -i drain사용하여 Kubernetes 이벤트의 항목을 확인할 수도 있습니다. 비슷한 출력은 "너무 많은 요청(일반적으로 pdb)에 의해 차단된 제거"라는 메시지를 보여 줍니다.

$ kubectl get events | grep -i drain
LAST SEEN   TYPE      REASON                    OBJECT                                   MESSAGE
(...)
32m         Normal    Drain                     node/aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx   Draining node: aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx
2m57s       Warning   Drain                     node/aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx   Eviction blocked by Too Many Requests (usually a pdb): <pod-name>
12m         Warning   Drain                     node/aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx   Eviction blocked by Too Many Requests (usually a pdb): <pod-name>
32m         Warning   Drain                     node/aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx   Eviction blocked by Too Many Requests (usually a pdb): <pod-name>
32m         Warning   Drain                     node/aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx   Eviction blocked by Too Many Requests (usually a pdb): <pod-name>
31m         Warning   Drain                     node/aks-<nodepool-name>-xxxxxxxx-vmssxxxxxx   Eviction blocked by Too Many Requests (usually a pdb): <pod-name>

이 문제를 해결하려면 다음 솔루션 중 하나를 사용합니다.

해결 방법 1: Pod가 드레이닝되도록 설정

  1. Pod 드레이닝이 가능하도록 PDB를 조정합니다. 일반적으로 허용되는 중단은 또는 Running pods / Replicas 매개 변수에 Min Available / Max unavailable 의해 제어됩니다. PDB 수준에서 매개 변수를 Min Available / Max unavailable 수정하거나 허용된 중단 값을 1 이상으로 푸시할 수를 Running pods / Replicas 늘릴 수 있습니다.

  2. AKS 클러스터를 이전에 업그레이드하려고 했던 것과 동일한 버전으로 업그레이드해 봅니다. 이 프로세스는 조정을 트리거합니다.

    $ az aks upgrade --name <aksName> --resource-group <resourceGroupName>
    Are you sure you want to perform this operation? (y/N): y
    Cluster currently in failed state. Proceeding with upgrade to existing version 1.28.3 to attempt resolution of failed cluster state.
    Since control-plane-only argument is not specified, this will upgrade the control plane AND all nodepools to version . Continue? (y/N): y
    

해결 방법 2: PDB 백업, 삭제 및 다시 배포

  1. 명령을 사용하여 PDB의 백업을 수행하고 명령을 kubectl get pdb <pdb-name> -n <pdb-namespace> -o yaml > pdb-name-backup.yaml사용하여 PDB를 삭제합니다 kubectl delete pdb <pdb-name> -n <pdb-namespace>. 새 업그레이드 시도가 완료되면 명령을 kubectl apply -f pdb-name-backup.yaml사용하여 백업 파일을 적용하는 PDB를 다시 배포할 수 있습니다.

  2. AKS 클러스터를 이전에 업그레이드하려고 했던 것과 동일한 버전으로 업그레이드해 봅니다. 이 프로세스는 조정을 트리거합니다.

    $ az aks upgrade --name <aksName> --resource-group <resourceGroupName>
    Are you sure you want to perform this operation? (y/N): y
    Cluster currently in failed state. Proceeding with upgrade to existing version 1.28.3 to attempt resolution of failed cluster state.
    Since control-plane-only argument is not specified, this will upgrade the control plane AND all nodepools to version . Continue? (y/N): y
    

솔루션 3: 드레이닝할 수 없는 Pod를 삭제하거나 워크로드를 0으로 축소(0)

  1. 드레이닝할 수 없는 Pod를 삭제합니다.

    참고

    배포 또는 StatefulSet에서 Pod를 만드는 경우 ReplicaSet에 의해 제어됩니다. 이 경우 워크로드 복제본을 삭제하거나 배포 또는 StatefulSet의 0으로 조정해야 할 수 있습니다. 이렇게 하기 전에 백업 kubectl get <deployment.apps -or- statefulset.apps> <name> -n <namespace> -o yaml > backup.yaml을 수행하는 것이 좋습니다.

  2. 축소하려면 조정 전에 사용할 kubectl scale --replicas=0 <deployment.apps -or- statefulset.apps> <name> -n <namespace> 수 있습니다.

  3. AKS 클러스터를 이전에 업그레이드하려고 했던 것과 동일한 버전으로 업그레이드해 봅니다. 이 프로세스는 조정을 트리거합니다.

    $ az aks upgrade --name <aksName> --resource-group <resourceGroupName>
    Are you sure you want to perform this operation? (y/N): y
    Cluster currently in failed state. Proceeding with upgrade to existing version 1.28.3 to attempt resolution of failed cluster state.
    Since control-plane-only argument is not specified, this will upgrade the control plane AND all nodepools to version . Continue? (y/N): y
    

도움을 요청하십시오.

질문이 있거나 도움이 필요한 경우 지원 요청을 생성하거나Azure 커뮤니티 지원에 문의하세요. Azure 피드백 커뮤니티에 제품 피드백을 제출할 수도 있습니다.