팟 (Pod) 보안 업그레이드 전제조건으로 인해 내 클러스터 업그레이드가 실패하는 이유는 무엇입니까?

IBM Cloud Kubernetes Service 를 Kubernetes 의 버전 1.24 에서 버전 1.25 로 업그레이드할 때, 업그레이드가 실패하고 다음 예시와 유사한 오류 메시지가 표시됩니다.

Version update canceled. CAE009: Cannot complete cluster master operations because the cluster does not pass Pod Security upgrade prerequisites. Reason: [ClusterRoleBinding 'restricted-psp-user' does not have expected subjects]. For more information, see the troubleshooting docs: 'https://ibm.biz/master_pod_security_upgrade_iks_125'

Kubernetes PodSecurityPolicy 입회 컨트롤러는 Kubernetes 1.25 에서 제거되었으며, 새로운 Pod Security 입회 컨트롤러로 대체되었습니다.

IBM Cloud Kubernetes Service 클러스터를 버전 1.24 에서 버전 1.25로 안전하게 업그레이드하려면 클러스터 PodSecurityPolicies (PSP) 및 연관된 역할 기반 액세스 제어가 다음 전제조건을 충족해야 합니다.

  • 5개의 IBM Cloud 정의된 PSP 이상의 PSP는 존재할 수 없습니다.
  • IBM Cloud 정의된 클러스터 역할 바인딩은 모든 사용자 및 서비스 계정에 IBM Cloud 정의된 권한 및 제한된 PSP를 사용할 수 있는 권한을 제공합니다.

이러한 전제조건은 클러스터의 버전 1.24 PodSecurityPolicy 구성이 버전 1.25 팟 (Pod) 보안 승인 구성과 동일하고 팟 (Pod) 보안 승인으로의 업그레이드 및 전환이 기존 애플리케이션을 중단하지 않도록 보장합니다. 이 전제조건은 써드파티 팟 (Pod) 보안 제공자의 사용을 배제하지 않습니다.

시작하기 전에

팟 (Pod) 보안 승인으로 마이그레이션할 준비가 되지 않은 경우 클러스터 마스터 새로 고치기를 수행하여 상태 메시지를 지울 수 있습니다.

이미 Pod Security Admission 업그레이드 전제 조건을 수행한 경우, 이 오류 메시지는 사용자가 놓쳤을 수 있는 작업이나 IBM Cloud Kubernetes Service 에 정의된 리소스에 발생한 예기치 않은 변경 사항 중 해결해야 할 사항을 나타냅니다. 표시되는 메시지에 따라 다음 단계를 완료하십시오.

다음 항목을 가져올 수 없습니다. PodSecurityPolicies

  1. PSP를 확인하려면 다음 명령을 실행하세요.
    kubectl get podsecuritypolicies
    
  2. 오류가 없는 경우 클러스터 마스터 업그레이드를 다시 시도하십시오.

비IBM PodSecurityPolicy 발견

제거해야 하는 추가 PSP가 있습니다.

클러스터를 버전 1.25로 업그레이드하기 전에 다음 PSP만 있는지 확인하십시오.

  • ibm-privileged-psp
  • ibm-anyuid-psp
  • ibm-anyuid-hostpath-psp
  • ibm-anyuid-hostaccess-psp
  • ibm-restricted-psp
  1. PSP를 나열하십시오.

    kubectl get podsecuritypolicies
    
  2. 추가적인 PodSecurityPolicy 가 더 이상 사용되지 않는다면 삭제하십시오. 추가 팟 (Pod) 보안 정책이 있는 경우 마이그레이션 안내서를 검토 하십시오.

    kubectl delete podsecuritypolicies PSP
    
  3. 클러스터 업그레이드를 재시도하십시오.

ClusterRoleBinding 를 얻을 수 없습니다. privileged-psp-user

이 메시지는 privileged-psp-user 클러스터 역할 바인딩이 존재하지 않거나 일부 다른 오류로 인해 업그레이드 조작이 자원을 읽을 수 없음을 표시합니다.

  1. 자원을 나열하십시오.
    kubectl get clusterrolebindings privileged-psp-user
    
  2. NotFound 오류가 발생하면 privileged-psp-user 클러스터 역할 바인딩 을 작성하거나 업데이트하십시오.

ClusterRoleBinding privileged-psp-user 기대하지 않은 roleRef

이 오류는 예기치 않은 변경 및 클러스터 역할 바인딩이 잘못된 클러스터 역할을 참조하고 있음을 나타냅니다.

  1. 클러스터 역할 바인딩을 삭제합니다.

    kubectl delete clusterrolebinding privileged-psp-user
    
  2. privileged-psp-user 클러스터 역할 바인딩 을 작성하십시오.

ClusterRoleBinding privileged-psp-user에 예상되는 주제가 없습니다

이 변경이 의도적인 경우 먼저 클러스터 역할 바인딩 을 사용하여 앱을 실행할 수 있는지 여부를 판별해야 합니다. 가능한 경우, restricted-psp-user 클러스터 역할 바인딩 을 작성하거나 업데이트하십시오.

ClusterRoleBinding 를 얻을 수 없습니다 restricted-psp-user

이 메시지는 restricted-psp-user 클러스터 역할 바인딩이 없거나 일부 기타 오류로 인해 업그레이드 조작이 자원을 읽을 수 없음을 표시합니다.

  1. restricted-psp-user 클러스터 역할 바인딩의 세부사항을 가져오십시오.
    kubectl get clusterrolebindings restricted-psp-user
    
  2. NotFound 오류가 발생하면 restricted-psp-user 클러스터 역할 바인딩 을 작성하거나 업데이트하십시오.

ClusterRoleBinding restricted-psp-user 기대하지 않은 roleRef

이 오류는 예기치 않은 변경이며 클러스터 역할 바인딩이 잘못된 클러스터 역할을 참조하고 있음을 표시합니다.

roleRef 를 변경하려면 다음 단계를 따르십시오.

  1. 클러스터 역할 바인딩을 삭제합니다.
    kubectl delete clusterrolebinding restricted-psp-user
    
  2. restricted-psp-user 클러스터 역할 바인딩 을 작성하거나 업데이트하십시오.

ClusterRoleBinding 제한된 Psp 사용자에게는 예상되는 주제가 없습니다

이 변경이 의도적인 경우, 먼저 클러스터 역할 바인딩 을 사용하여 애플리케이션을 제대로 실행할 수 있는지 여부를 판별해야 합니다.

그런 다음, restricted-psp-user 클러스터 역할 바인딩 을 작성하거나 업데이트하십시오.

privileged-psp-user 를 생성하거나 업데이트하기 ClusterRoleBinding

다음 명령을 실행하여 privileged-psp-user 클러스터 역할 바인딩을 작성하거나 업데이트하십시오.

kubectl apply -f - <<EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: privileged-psp-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ibm-privileged-psp-user
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:masters
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:nodes
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:serviceaccounts
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:authenticated
EOF

restricted-psp-user 클러스터 역할 바인딩 작성

restricted-psp-user 를 생성하거나 업데이트하려면 다음 명령을 실행하십시오. ClusterRoleBinding

kubectl apply -f - <<EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: restricted-psp-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ibm-restricted-psp-user
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:masters
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:nodes
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:serviceaccounts
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: system:authenticated
EOF