다음을 통해 공유


리소스 전파 실패: ClusterResourcePlacementApplied가 False입니다.

이 문서에서는 Microsoft Azure Kubernetes Fleet Manager에서 개체 API를 사용하여 리소스를 ClusterResourcePlacement 전파할 때 발생하는 문제를 해결하는 ClusterResourcePlacementApplied 방법을 설명합니다.

증상

Azure Kubernetes Fleet Manager에서 ClusterResourcePlacement API 개체를 사용하여 리소스를 전파하면 배포가 실패합니다. 상태는 ClusterResourcePlacementApplied 다음과 같이 False표시됩니다.

원인

이 문제는 다음 이유 중 하나로 인해 발생할 수 있습니다.

  • 리소스는 클러스터에 이미 있으며 플릿 컨트롤러에서 관리되지 않습니다. 이 문제를 해결하려면 플릿 컨트롤러가 ClusterResourcePlacement 리소스를 관리할 수 있도록 내에서 ApplyStrategy 사용할 AllowCoOwnership 매니페스트 YAML 파일을 업데이트합니다.
  • 다른 ClusterResourcePlacement 배포는 이미 다른 적용 전략을 사용하여 선택한 클러스터의 리소스를 관리하고 있습니다.
  • ClusterResourcePlacement 구문 오류 또는 잘못된 리소스 구성으로 인해 배포에서 매니페스트를 적용하지 않습니다. 이 문제는 봉투 개체를 통해 리소스가 전파되는 경우에도 발생할 수 있습니다.

문제 해결 단계

  1. ClusterResourcePlacement 상태를 보고 섹션을 찾습니다placementStatuses. placementStatuses 값을 확인하여 조건이 설정된 False클러스터를 ResourceApplied 식별하고 해당 clusterName 값을 기록해 둡니다.
  2. Work 허브 클러스터에서 개체를 찾습니다. 식별된 clusterName 개체를 사용하여 멤버 클러스터와 연결된 개체를 찾 Work 습니다. 자세한 내용은 연결된 ClusterResourcePlacement올바른 작업 리소스를 찾는 방법을 참조하세요.
  3. 개체의 Work 상태를 확인하여 성공적인 리소스 애플리케이션을 방해하는 특정 문제를 이해합니다.

사례 연구

다음 예제 ClusterResourcePlacement 에서는 배포가 포함된 네임스페이스를 두 멤버 클러스터에 전파하려고 합니다. 그러나 네임스페이스는 한 멤버 클러스터, 특히 이미 존재합니다 kind-cluster-1.

ClusterResourcePlacement 사양

apiVersion: placement.kubernetes-fleet.io/v1beta1
kind: ClusterResourcePlacement
metadata:
  name: crp
spec:
  policy:
    clusterNames:
    - kind-cluster-1
    - kind-cluster-2
    placementType: PickFixed
  resourceSelectors:
  - group: ""
    kind: Namespace
    name: test-ns
    version: v1
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate

ClusterResourcePlacement 상태

status:
  conditions:
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message:couldn't find all the clusters needed as specified by the scheduling
      policy
    observedGeneration: 1
    reason: SchedulingPolicyUnfulfilled
    status: "False"
    type: ClusterResourcePlacementScheduled
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message: All 2 cluster(s) start rolling out the latest resource
    observedGeneration: 1
    reason: RolloutStarted
    status: "True"
    type: ClusterResourcePlacementRolloutStarted
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message: No override rules are configured for the selected resources
    observedGeneration: 1
    reason: NoOverrideSpecified
    status: "True"
    type: ClusterResourcePlacementOverridden
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message: Works(s) are succcesfully created or updated in the 2 target clusters'
      namespaces
    observedGeneration: 1
    reason: WorkSynchronized
    status: "True"
    type: ClusterResourcePlacementWorkSynchronized
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message: Failed to apply resources to 1 clusters, please check the `failedPlacements`
      status
    observedGeneration: 1
    reason: ApplyFailed
    status: "False"
    type: ClusterResourcePlacementApplied
  observedResourceIndex: "0"
  placementStatuses:
  - clusterName: kind-cluster-2
    conditions:
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: 'Successfully scheduled resources for placement in kind-cluster-2 (affinity
        score: 0, topology spread score: 0): picked by scheduling policy'
      observedGeneration: 1
      reason: Scheduled
      status: "True"
      type: Scheduled
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: Detected the new changes on the resources and started the rollout process
      observedGeneration: 1
      reason: RolloutStarted
      status: "True"
      type: RolloutStarted
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: No override rules are configured for the selected resources
      observedGeneration: 1
      reason: NoOverrideSpecified
      status: "True"
      type: Overridden
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: All of the works are synchronized to the latest
      observedGeneration: 1
      reason: AllWorkSynced
      status: "True"
      type: WorkSynchronized
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: All corresponding work objects are applied
      observedGeneration: 1
      reason: AllWorkHaveBeenApplied
      status: "True"
      type: Applied
    - lastTransitionTime: "2024-05-07T23:32:49Z"
      message: The availability of work object crp-4-work isn't trackable
      observedGeneration: 1
      reason: WorkNotTrackable
      status: "True"
      type: Available
  - clusterName: kind-cluster-1
    conditions:
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: 'Successfully scheduled resources for placement in kind-cluster-1 (affinity
        score: 0, topology spread score: 0): picked by scheduling policy'
      observedGeneration: 1
      reason: Scheduled
      status: "True"
      type: Scheduled
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: Detected the new changes on the resources and started the rollout process
      observedGeneration: 1
      reason: RolloutStarted
      status: "True"
      type: RolloutStarted
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: No override rules are configured for the selected resources
      observedGeneration: 1
      reason: NoOverrideSpecified
      status: "True"
      type: Overridden
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: All of the works are synchronized to the latest
      observedGeneration: 1
      reason: AllWorkSynced
      status: "True"
      type: WorkSynchronized
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: Work object crp-4-work isn't applied
      observedGeneration: 1
      reason: NotAllWorkHaveBeenApplied
      status: "False"
      type: Applied
    failedPlacements:
    - condition:
        lastTransitionTime: "2024-05-07T23:32:40Z"
        message: 'Failed to apply manifest: failed to process the request due to a
          client error: resource exists and isn't managed by the fleet controller
          and co-ownernship is disallowed'
        reason: ManifestsAlreadyOwnedByOthers
        status: "False"
        type: Applied
      kind: Namespace
      name: test-ns
      version: v1
  selectedResources:
  - kind: Namespace
    name: test-ns
    version: v1
  - group: apps
    kind: Deployment
    name: test-nginx
    namespace: test-ns
    version: v1

failedPlacements 에 대한 kind-cluster-1message 섹션에서 필드는 리소스가 멤버 클러스터에 적용되지 않은 이유를 설명합니다. 이전 conditions 섹션에서 조건에 플래그 kind-cluster-1 가 지정 false 되고 그 이유가 표시됩니다 NotAllWorkHaveBeenApplied Applied. 이는 멤버 클러스터 kind-cluster-1 에 대한 개체가 적용되지 않았음을 나타냅니다Work. 자세한 내용은 연결된 ClusterResourcePlacement올바른 작업 리소스를 찾는 방법을 참조하세요.

kind-cluster-1의 작업 상태

 status:
  conditions:
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message: 'Apply manifest {Ordinal:0 Group: Version:v1 Kind:Namespace Resource:namespaces
      Namespace: Name:test-ns} failed'
    observedGeneration: 1
    reason: WorkAppliedFailed
    status: "False"
    type: Applied
  - lastTransitionTime: "2024-05-07T23:32:40Z"
    message: ""
    observedGeneration: 1
    reason: WorkAppliedFailed
    status: Unknown
    type: Available
  manifestConditions:
  - conditions:
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: 'Failed to apply manifest: failed to process the request due to a client
        error: resource exists and isn't managed by the fleet controller and co-ownernship
        is disallowed'
      reason: ManifestsAlreadyOwnedByOthers
      status: "False"
      type: Applied
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: Manifest isn't applied yet
      reason: ManifestApplyFailed
      status: Unknown
      type: Available
    identifier:
      kind: Namespace
      name: test-ns
      ordinal: 0
      resource: namespaces
      version: v1
  - conditions:
    - lastTransitionTime: "2024-05-07T23:32:40Z"
      message: Manifest is already up to date
      observedGeneration: 1
      reason: ManifestAlreadyUpToDate
      status: "True"
      type: Applied
    - lastTransitionTime: "2024-05-07T23:32:51Z"
      message: Manifest is trackable and available now
      observedGeneration: 1
      reason: ManifestAvailable
      status: "True"
      type: Available
    identifier:
      group: apps
      kind: Deployment
      name: test-nginx
      namespace: test-ns
      ordinal: 1
      resource: deployments
      version: v1

Work 상태, 특히 섹션을 확인합니다manifestConditions. 네임스페이스를 적용할 수 없지만 네임스페이스 내의 배포가 허브에서 멤버 클러스터로 전파된 것을 볼 수 있습니다.

해결

이 경우 잠재적인 해결 방법은 ApplyStrategy 정책에서 이를 설정하는 AllowCoOwnership 것입니다 true . 그러나 리소스를 공유하지 않을 수 있으므로 사용자가 이 결정을 내려야 합니다.

또한 작업 컨트롤러 적용에 대한 로그를 검토하여 리소스를 사용할 수 없는 이유에 대한 자세한 정보를 얻을 수 있습니다.

도움을 요청하십시오.

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