Omówienie stanu rozmieszczania zasobów w usłudze Azure Kubernetes Fleet Manager

Dotyczy: ✔️ Fleet Manager z klastrem hubowym

Podczas pracy z usługą Azure Kubernetes Fleet Manager zrozumienie stanu ClusterResourcePlacement zasobów ma kluczowe znaczenie dla monitorowania postępu wdrażania i rozwiązywania problemów.

Podczas pracy z usługą Azure Kubernetes Fleet Manager zrozumienie stanu ResourcePlacement zasobów ma kluczowe znaczenie dla monitorowania postępu wdrażania i rozwiązywania problemów.

Wymagania wstępne

Przegląd struktury statusu lokalizacji

Obiekt ClusterResourcePlacement zawiera nie tylko opisową specyfikację dotyczącą umieszczania, ale także stan operacji umieszczania.

Obiekt ResourcePlacement zawiera nie tylko opisową specyfikację dotyczącą umieszczania, ale także stan operacji umieszczania.

Sekcja stanu zawiera szczegółowe informacje na temat:

  • Ogólny stan umieszczania wyrażony za pomocą warunków
  • Zasoby wybrane przez przydział
  • Status rozmieszczenia każdego klastra wyrażony za pomocą warunków
  • rozmieszczenie elementów Failed, drifted i diffed w każdym klastrze

Aby wyświetlić stan umieszczania, użyj następującego polecenia:

kubectl describe clusterresourceplacement <placement-name>
kubectl describe resourceplacement <placement-name> -n <namespace-name>

Aby uzyskać nieprzetworzone dane wyjściowe YAML, użyj następującego polecenia:

kubectl get clusterresourceplacement <placement-name> -o yaml
kubectl get resourceplacement <placement-name> -n <namespace-name> -o yaml

Pola stanu najwyższego poziomu

Sekcja stanu zawiera następujące pola najwyższego poziomu:

  • selectedResources: lista zasobów wybranych dla umieszczenia
  • warunki: tablica ogólnych warunków umieszczania
  • observedResourceIndex: indeks bieżącej migawki zasobu
  • placementStatuses: Informacje o stanie rozmieszczenia dla poszczególnych klastrów

W poniższych sekcjach szczegółowo opisano poszczególne pola.

Wybrane zasoby

Pole selectedResources wyświetla wszystkie zasoby wybrane przez rozmieszczenie. Użyj tego pola, aby sprawdzić, czy oczekiwane zasoby są uwzględnione w umiejscowieniu. Oto przykład:

selectedResources:
- kind: Namespace
  name: test
  version: v1
- kind: ConfigMap
  name: test-config
  namespace: test
  version: v1
  envelope:
    name: example-envelope
    namespace: test
    type: ResourceEnvelope
- kind: Deployment
  name: web-app
  namespace: test
  group: apps
  version: v1
- kind: Service
  name: web-service
  namespace: test
  version: v1
- kind: Secret
  name: app-secrets
  namespace: test
  version: v1
selectedResources:
- kind: ConfigMap
  name: test-config
  version: v1
  envelope:
    name: example-envelope
    namespace: test
    type: ResourceEnvelope
- kind: Deployment
  name: web-app
  group: apps
  version: v1
- kind: Service
  name: web-service
  version: v1
- kind: Secret
  name: app-secrets
  version: v1

Każdy wpis zasobu obejmuje:

  • grupa: grupa interfejsu API (pusta dla zasobów podstawowych)
  • version: wersja interfejsu API (na przykład v1, v1beta1)
  • rodzaj: Rodzaj zasobu
  • name: Nazwa zasobu
  • przestrzeń nazw: Przestrzeń nazw (dla zasobów w przestrzeni nazw)
  • koperta: Jeśli zasób jest opakowany w kopertę, udostępniane są również metadane koperty, w tym:
    • name: Nazwa koperty
  • przestrzeń nazw: Przestrzeń nazw koperty
  • typ: typ koperty (na przykład ResourceEnvelope)

Warunki umieszczania

Tablica conditions zawiera ogólne informacje o stanie całego rozmieszczenia. Każdy warunek jest zgodny ze wspólną definicją platformy Kubernetes, która ma następujące standardowe pola:

  • type: typ warunku (opisany w poniższych sekcjach).
  • status: True, lub FalseUnknown.
  • reason: Krótki kod przyczyny warunku.
  • komunikat: opis czytelny dla człowieka.
  • lastTransitionTime: kiedy warunek został ostatnio zmieniony.
  • observedGeneration: Generacja rozmieszczenia w momencie ustawienia warunku.

Typy warunków ClusterResourcePlacement

Następujące typy warunków są dostępne dla KlasterResourcePlacement:

ZasóbKlastraUmiejscowienieZaplanowane

Typy warunków rozmieszczenia zasobów

Następujące typy warunków są dostępne dla usługi ResourcePlacement:

PlanowaneUmieszczenieZasobów

Rozmieszczenie wskazuje, czy zostało pomyślnie zaplanowane dla klastrów docelowych.

  • Prawda: wszystkie wymagane klastry zostały wybrane zgodnie z zasadami rozmieszczania.
  • Fałsz: Planowanie nie powiodło się (na przykład niewystarczająca liczba dostępnych klastrów).
  • Nieznane: decyzja harmonogramowania oczekuje.
conditions:
- type: ClusterResourcePlacementScheduled
  status: "True"
  reason: SchedulingPolicyFulfilled
  message: "found all the clusters needed as specified by the scheduling policy"
  lastTransitionTime: "2023-11-10T08:14:52Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementScheduled
  status: "True"
  reason: SchedulingPolicyFulfilled
  message: "found all the clusters needed as specified by the scheduling policy"
  lastTransitionTime: "2023-11-10T08:14:52Z"
  observedGeneration: 5

Rozpoczęto wdrażanie rozmieszczenia zasobów klastra

Rozpoczęto Rozmieszczanie Zasobów

Wskazuje, czy wdrożenie zostało uruchomione w wybranych klastrach.

  • True: Rozpoczęto wdrażanie zasobów do zaplanowanych klastrów.
  • False: Wdrażanie jeszcze się nie rozpoczęło.
  • Nieznany: decyzja dotycząca wdrożenia nie została jeszcze podjęta.
conditions:
- type: ClusterResourcePlacementRolloutStarted
  status: "True"
  reason: RolloutStarted
  message: "All 3 cluster(s) start rolling out the latest resource"
  lastTransitionTime: "2023-11-10T08:15:30Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementRolloutStarted
  status: "True"
  reason: RolloutStarted
  message: "All 3 cluster(s) start rolling out the latest resource"
  lastTransitionTime: "2023-11-10T08:15:30Z"
  observedGeneration: 5

ClusterResourcePlacementOverridden

UmieszczenieZasobuZastąpione

Wskazuje, czy przesłonięcia zasobów zostały pomyślnie zastosowane.

  • True: Wszystkie odpowiednie zastąpienia są przetwarzane.
  • Fałsz: Nie można zastosować niektórych przesłonięć.
  • Nieznany: Trwa oczekiwanie na zastąpienie przetwarzania.
conditions:
- type: ClusterResourcePlacementOverridden
  status: "True"
  reason: NoOverrideSpecified
  message: "No override rules are configured for the selected resources"
  lastTransitionTime: "2023-11-10T08:15:45Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementOverridden
  status: "True"
  reason: NoOverrideSpecified
  message: "No override rules are configured for the selected resources"
  lastTransitionTime: "2023-11-10T08:15:45Z"
  observedGeneration: 5

ClusterResourcePlacementWorkSynchronized

SkoordynowaneUmieszczanieZasobówPracy

Wskazuje, czy proces tworzy obiekty robocze w przestrzeniach nazw poszczególnych klastrów klastra centralnego.

  • Prawda: wszystkie obiekty robocze są synchronizowane.
  • Fałsz: synchronizacja pracy kończy się niepowodzeniem lub jest niekompletna.
  • Nieznany: Synchronizacja pracy oczekuje.
conditions:
- type: ClusterResourcePlacementWorkSynchronized  
  status: "True"
  reason: SynchronizeSucceeded
  message: "All 2 cluster(s) are synchronized to the latest resources on the hub cluster"
  lastTransitionTime: "2023-11-10T08:23:43Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementWorkSynchronized  
  status: "True"
  reason: SynchronizeSucceeded
  message: "All 2 cluster(s) are synchronized to the latest resources on the hub cluster"
  lastTransitionTime: "2023-11-10T08:23:43Z"
  observedGeneration: 5

ClusterResourcePlacementApplied

ZastosowaneUmieszczenieZasobu

Wskazuje, czy wszystkie zasoby zostały pomyślnie zastosowane do klastrów członkowskich.

  • Prawda: wszystkie zasoby zostały pomyślnie zastosowane do wszystkich klastrów docelowych.
  • Fałsz: Nie można zastosować niektórych zasobów (sprawdź failedPlacements).
  • Nieznany: Operacja zastosowania oczekuje.
conditions:
- type: ClusterResourcePlacementApplied
  status: "True"
  reason: ApplySucceeded
  message: "The selected resources are successfully applied to 3 clusters"
  lastTransitionTime: "2023-11-10T08:16:15Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementApplied
  status: "True"
  reason: ApplySucceeded
  message: "The selected resources are successfully applied to 3 clusters"
  lastTransitionTime: "2023-11-10T08:16:15Z"
  observedGeneration: 5

Dostępność rozmieszczenia zasobów klastra

DostępnośćUmiejscowieniaZasobu

Wskazuje, czy umieszczone zasoby są dostępne i gotowe w klastrach członkowskich.

  • Prawda: wszystkie zasoby są dostępne we wszystkich klastrach docelowych.
  • Fałsz: Niektóre zasoby nie są jeszcze dostępne.
  • Nieznany: Sprawdzanie dostępności jest w toku.
conditions:
- type: ClusterResourcePlacementAvailable
  status: "True"
  reason: ResourceAvailable
  message: "The selected resources in 3 clusters are available now"
  lastTransitionTime: "2023-11-10T08:16:30Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementAvailable
  status: "True"
  reason: ResourceAvailable
  message: "The selected resources in 3 clusters are available now"
  lastTransitionTime: "2023-11-10T08:16:30Z"
  observedGeneration: 5

RóżnicaZgłoszonaUmieszczeniaZasobuKlastra

ZgłoszonaRóżnicaRozmieszczaniaZasobów

Wskazuje, czy są zgłaszane różnice konfiguracji (w przypadku korzystania ze strategii ReportDiff).

  • True: Pełny raport różnic jest dostępny.
  • Fałsz: Raportowanie różnic nie powiodło się lub jest niekompletne.
  • Nieznany: Raportowanie różnic oczekuje.
conditions:
- type: ClusterResourcePlacementDiffReported
  status: "True"
  reason: DiffReportComplete
  message: "Configuration differences are reported for all target clusters"
  lastTransitionTime: "2023-11-10T08:16:45Z"
  observedGeneration: 5
conditions:
- type: ResourcePlacementDiffReported
  status: "True"
  reason: DiffReportComplete
  message: "Configuration differences are reported for all target clusters"
  lastTransitionTime: "2023-11-10T08:16:45Z"
  observedGeneration: 5

Migawki zasobów

Pole observedResourceIndex wskazuje, która z migawek zasobów jest obecnie wdrażana.

observedResourceIndex: "1"

Usługa Fleet Manager tworzy migawki zasobów w różny sposób w zależności od strategii wdrażania:

W przypadku RollingUpdate strategii (ustawienie domyślne): Usługa Fleet Manager automatycznie tworzy migawki zasobów, gdy:

  • Selektory zasobów zmieniają się
  • Zmodyfikujesz wybrane zasoby

W przypadku strategii External: Usługa Fleet Manager nie tworzy automatycznie migawek zasobów. Zamiast tego tworzy je, gdy uruchomisz aktualizację etapową i pominiesz pole resourceSnapshotIndex. Ten warunek oznacza, że gdy po raz pierwszy utworzysz wdrożenie ze strategią wdrażania External, nie istnieją żadne migawki zasobów, dopóki nie uruchomisz pierwszego przebiegu aktualizacji etapowej.

Uwaga / Notatka

Jeśli umiejscowienie wcześniej korzystało ze strategii RollingUpdate i zmienisz ją na External, istniejące migawki zasobów pozostaną dostępne. Możesz odwoływać się do tych istniejących migawek podczas tworzenia przebiegów aktualizacji etapowych.

Każda migawka ma unikatowy indeks. Migawki można wyświetlić za pomocą:

kubectl get clusterresourcesnapshot --selector=kubernetes-fleet.io/resource-index=1
kubectl get resourcesnapshot -n <namespace-name> --selector=kubernetes-fleet.io/resource-index=1

Stan umieszczania poszczególnych klastrów

Tablica placementStatuses zawiera szczegółowy stan każdego klastra, w którym zostaną umieszczone zasoby lub podjęto próbę ich umieszczenia:

placementStatuses:
- clusterName: aks-member-1
  observedResourceIndex: "1"
  conditions:
    - type: ResourceScheduled
      status: "True"
      reason: ScheduleSucceeded
      message: "Successfully scheduled resources for placement in aks-member-1"
      lastTransitionTime: "2023-11-10T08:14:52Z"
      observedGeneration: 5
    - type: RolloutStarted
      status: "True"
      reason: RolloutStarted
      message: "Detected the new changes on the resources and started the rollout process"
      lastTransitionTime: "2023-11-10T08:15:30Z"
      observedGeneration: 5
    - type: Overridden
      status: "True"
      reason: NoOverrideSpecified
      message: "No override rules are configured for the selected resources"
      lastTransitionTime: "2023-11-10T08:15:45Z"
      observedGeneration: 5
    - type: WorkSynchronized
      status: "True"
      reason: AllWorkSynced
      message: "All of the works are synchronized to the latest"
      lastTransitionTime: "2023-11-10T08:16:00Z"
      observedGeneration: 5
    - type: Applied
      status: "True"
      reason: AllWorkHaveBeenApplied
      message: "All corresponding work objects are applied"
      lastTransitionTime: "2023-11-10T08:16:15Z"
      observedGeneration: 5
    - type: Available
      status: "True"
      reason: ResourceAvailable
      message: "All resources are available on the target cluster"
      lastTransitionTime: "2023-11-10T08:16:30Z"
      observedGeneration: 5
  failedPlacements: []
  driftedPlacements: []
  diffedPlacements: []
- clusterName: aks-member-2
  observedResourceIndex: "1"
  conditions:
    - type: ResourceScheduled
      status: "True"
      reason: ScheduleSucceeded
      message: "Successfully scheduled resources for placement in aks-member-2"
      lastTransitionTime: "2023-11-10T08:14:52Z"
      observedGeneration: 5
    - type: Applied
      status: "False"
      reason: AppliedManifestFailedReason
      message: "Failed to apply some manifests"
      lastTransitionTime: "2023-11-10T08:16:15Z"
      observedGeneration: 5
  failedPlacements:
    - kind: Deployment
      name: web-app
      namespace: test
      version: apps/v1
      condition:
        type: Applied
        status: "False"
        reason: AppliedManifestFailedReason
        message: "Failed to apply manifest: insufficient resources"
        lastTransitionTime: "2023-11-10T08:16:15Z"

Typy warunków dla klastra

Stan każdego klastra obejmuje warunki śledzenia cyklu życia wdrożenia:

ZasóbZaplanyowany

Wskazuje, czy klaster został pomyślnie wybrany do przypisania.

- type: ResourceScheduled
  status: "True"
  reason: ScheduleSucceeded
  message: "Successfully scheduled resources for placement in aks-member-1 (affinity score: 0, topology spread score: 0): picked by scheduling policy"
  lastTransitionTime: "2023-11-10T08:14:52Z"
  observedGeneration: 5

Rozpoczęto wdrożenie

Wskazuje, czy wdrożenie rozpoczęło się w tym konkretnym klastrze.

- type: RolloutStarted
  status: "True"
  reason: RolloutStarted
  message: "Detected new changes on the resources and started the rollout process"
  lastTransitionTime: "2023-11-10T08:15:30Z"
  observedGeneration: 5

Zastąpiona

Wskazuje, czy dla tego klastra są stosowane przesłonięcia zasobów.

- type: Overridden
  status: "True"
  reason: NoOverrideSpecified
  message: "No override rules are configured for the selected resources"
  lastTransitionTime: "2023-11-10T08:15:45Z"
  observedGeneration: 5

Synchronizacja pracy

Wskazuje, czy obiekty robocze są tworzone dla tego klastra.

- type: WorkSynchronized
  status: "True"
  reason: AllWorkSynced
  message: "All of the works are synchronized to the latest"
  lastTransitionTime: "2023-11-10T08:16:00Z"
  observedGeneration: 5

Zastosowano

Wskazuje, czy wszystkie zasoby zostały pomyślnie zastosowane do tego klastra.

- type: Applied
  status: "True"
  reason: AllWorkHaveBeenApplied
  message: "All corresponding work objects are applied"
  lastTransitionTime: "2023-11-10T08:16:15Z"
  observedGeneration: 5

Dostępny

Wskazuje, czy wszystkie zasoby są dostępne i gotowe w tym klastrze.

- type: Available
  status: "True"
  reason: ResourceAvailable
  message: "All resources are available on the target cluster"
  lastTransitionTime: "2023-11-10T08:16:30Z"
  observedGeneration: 5

Różniceraportowane

Wskazuje, czy dla tego klastra są zgłaszane różnice konfiguracji.

- type: DiffReported
  status: "True"
  reason: DiffReportComplete
  message: "Configuration differences are reported for this cluster"
  lastTransitionTime: "2023-11-10T08:16:45Z"
  observedGeneration: 5

Nieudane umieszczanie

Gdy nie można zastosować zasobów do klastra, system rejestruje szczegóły w tablicy failedPlacements :

failedPlacements:
- kind: Deployment
  name: my-app
  namespace: default
  version: apps/v1
  condition:
    type: Applied
    status: "False"
    reason: AppliedManifestFailedReason
    message: "Failed to apply manifest: namespaces 'app' not found"
    lastTransitionTime: "2023-12-06T00:09:53Z"
  envelope:
    name: example
    namespace: app
    type: ResourceEnvelope
- kind: Service
  name: my-service
  namespace: default
  version: v1
  condition:
    type: Applied
    status: "False"
    reason: AppliedManifestFailedReason
    message: "Failed to apply manifest: Service 'my-service' is forbidden: User 'system:serviceaccount:fleet-system:fleet-agent' cannot create resource 'services' in API group '' in the namespace 'default'"
    lastTransitionTime: "2023-12-06T00:10:15Z"
- kind: ConfigMap
  name: app-config
  namespace: production
  version: v1
  condition:
    type: Applied
    status: "False"
    reason: AppliedManifestFailedReason
    message: "Failed to apply manifest: configmaps 'app-config' already exists"
    lastTransitionTime: "2023-12-06T00:10:30Z"

Każda nieudana próba umieszczenia obejmuje:

  • Identyfikacja zasobu: grupa, wersja, rodzaj, nazwa, przestrzeń nazw
  • warunek: określony warunek niepowodzenia
  • koperta: informacje o kopercie, jeśli ma to zastosowanie

Przemieszczone umiejscowienia

Fleet Manager zawsze zgłasza zasoby, które odbiegają od pożądanego stanu:

driftedPlacements:
- kind: Namespace
  name: web
  version: v1
  observationTime: "2025-03-19T06:50:25Z"
  firstDriftedObservedTime: "2025-03-19T06:49:54Z"
  targetClusterObservedGeneration: 12
  observedDrifts:
  - path: "/metadata/labels/owner"
    valueInHub: "simon"
    valueInMember: "chen"
  - path: "/metadata/annotations/purpose"
    valueInHub: "production"
    valueInMember: "testing"
- kind: Deployment
  name: web-app
  namespace: web
  group: apps
  version: v1
  observationTime: "2025-03-19T06:50:25Z"
  firstDriftedObservedTime: "2025-03-19T06:49:54Z"
  targetClusterObservedGeneration: 8
  observedDrifts:
  - path: "/spec/replicas"
    valueInHub: "3"
    valueInMember: "5"
  - path: "/spec/template/spec/containers/0/image"
    valueInHub: "nginx:1.20"
    valueInMember: "nginx:1.21"
- kind: ConfigMap
  name: app-config
  namespace: web
  version: v1
  observationTime: "2025-03-19T06:50:25Z"
  firstDriftedObservedTime: "2025-03-19T06:49:54Z"
  targetClusterObservedGeneration: 5
  observedDrifts:
  - path: "/data/environment"
    valueInHub: "production"
    valueInMember: "staging"

Każde położenie dryfujące obejmuje:

  • Identyfikacja zasobu: grupa, wersja, rodzaj, nazwa, przestrzeń nazw
  • observationTime: Kiedy po raz ostatni zaobserwowano dryf
  • firstDriftedObservedTime: Czas pierwszego wykrycia odchylenia
  • targetClusterObservedGeneration: Generacja zasobu w klastrze członkowskim
  • observedDrifts: Szczegółowa lista różnic konfiguracji

Różnice umieszczania

Gdy używasz strategii stosowania ReportDiff, usługa Fleet Manager raportuje różnice w konfiguracji.

diffedPlacements:
- kind: Service
  name: my-service
  namespace: default
  version: v1
  observationTime: "2025-03-19T06:50:25Z"
  firstDiffedObservedTime: "2025-03-19T06:49:54Z"
  targetClusterObservedGeneration: 8
  observedDiffs:
  - path: "/spec/ports/0/nodePort"
    valueInHub: ""
    valueInMember: "30080"
  - path: "/spec/clusterIP"
    valueInHub: ""
    valueInMember: "10.96.100.200"
- kind: Deployment
  name: web-app
  namespace: default
  group: apps
  version: v1
  observationTime: "2025-03-19T06:50:25Z"
  firstDiffedObservedTime: "2025-03-19T06:49:54Z"
  targetClusterObservedGeneration: 12
  observedDiffs:
  - path: "/status/replicas"
    valueInHub: ""
    valueInMember: "3"
  - path: "/status/readyReplicas"
    valueInHub: ""
    valueInMember: "3"
  - path: "/metadata/generation"
    valueInHub: "1"
    valueInMember: "2"

Umiejscowienia różnicowe mają podobną strukturę do przemieszczonych umiejscowień, ale są używane w odmiennych scenariuszach.

  • Dryfowane umieszczanie: należy używać podczas stosowania zasobów, ale następnie je zmieniać.
  • Różnice umieszczania: używaj z strategią ReportDiff lub gdy warunki przejęcia nie są spełnione.

Monitorowanie postępów umieszczania

Aby skutecznie monitorować postęp umieszczania, sprawdź następujące kluczowe wskaźniki:

  1. Umieszczony zasób: Sprawdź, czy ClusterResourcePlacementWorkSynchronized ma wartość True
  2. Ogólna kondycjaClusterResourcePlacementApplied: Sprawdź stan
  3. Stan klastra: Przegląd warunków dla każdego klastra docelowego
  4. Nieudane umieszczenia: Sprawdź, czy w tablicach failedPlacements są jakieś wpisy
  1. Umieszczony zasób: Sprawdź, czy ResourcePlacementWorkSynchronized ma wartość True
  2. Ogólna kondycjaResourcePlacementApplied: Sprawdź stan
  3. Stan klastra: Przegląd warunków dla każdego klastra docelowego
  4. Nieudane umiejscowienia: Sprawdź, czy w tablicach failedPlacements znajdują się jakieś wpisy

Kompletny przykład stanu

Oto pełny przykład, który pokazuje kompletny stan dla ClusterResourcePlacement.

apiVersion: placement.kubernetes-fleet.io/v1
kind: ClusterResourcePlacement
metadata:
  name: web-app-placement
  generation: 5
spec:
  resourceSelectors:
  - group: ""
    kind: Namespace
    name: web-app
    version: v1
  - group: apps
    kind: Deployment
    name: web-server
    namespace: web-app
    version: v1
  - group: ""
    kind: Service
    name: web-service
    namespace: web-app
    version: v1
  policy:
    placementType: PickN
    numberOfClusters: 2
    affinity:
      clusterAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          clusterSelectorTerms:
          - matchLabels:
              region: us-west
status:
  conditions:
  - type: ClusterResourcePlacementScheduled
    status: "True"
    reason: SchedulingPolicyFulfilled
    message: "found all the clusters needed as specified by the scheduling policy"
    lastTransitionTime: "2023-11-10T08:14:52Z"
    observedGeneration: 5
  - type: ClusterResourcePlacementRolloutStarted
    status: "True"
    reason: RolloutStarted
    message: "All 2 cluster(s) start rolling out the latest resource"
    lastTransitionTime: "2023-11-10T08:15:30Z"
    observedGeneration: 5
  - type: ClusterResourcePlacementOverridden
    status: "True"
    reason: NoOverrideSpecified
    message: "No override rules are configured for the selected resources"
    lastTransitionTime: "2023-11-10T08:15:45Z"
    observedGeneration: 5
  - type: ClusterResourcePlacementWorkSynchronized
    status: "True"
    reason: SynchronizeSucceeded
    message: "All 2 cluster(s) are synchronized to the latest resources on the hub cluster"
    lastTransitionTime: "2023-11-10T08:16:00Z"
    observedGeneration: 5
  - type: ClusterResourcePlacementApplied
    status: "True"
    reason: ApplySucceeded
    message: "The selected resources are successfully applied to 2 clusters"
    lastTransitionTime: "2023-11-10T08:16:15Z"
    observedGeneration: 5
  - type: ClusterResourcePlacementAvailable
    status: "True"
    reason: ResourceAvailable
    message: "The selected resources in 2 cluster are available now"
    lastTransitionTime: "2023-11-10T08:16:30Z"
    observedGeneration: 5
  observedResourceIndex: "1"
  selectedResources:
  - group: ""
    kind: Namespace
    name: web-app
    version: v1
  - group: apps
    kind: Deployment
    name: web-server
    namespace: web-app
    version: v1
  - group: ""
    kind: Service
    name: web-service
    namespace: web-app
    version: v1
  placementStatuses:
  - clusterName: aks-west-1
    observedResourceIndex: "1"
    conditions:
    - type: ResourceScheduled
      status: "True"
      reason: ScheduleSucceeded
      message: "Successfully scheduled resources for placement in aks-west-1 (affinity score: 0, topology spread score: 0): picked by scheduling policy"
      lastTransitionTime: "2023-11-10T08:14:52Z"
      observedGeneration: 5
    - type: RolloutStarted
      status: "True"
      reason: RolloutStarted
      message: "Detected the new changes on the resources and started the rollout process"
      lastTransitionTime: "2023-11-10T08:15:30Z"
      observedGeneration: 5
    - type: Overridden
      status: "True"
      reason: NoOverrideSpecified
      message: "No override rules are configured for the selected resources"
      lastTransitionTime: "2023-11-10T08:15:45Z"
      observedGeneration: 5
    - type: WorkSynchronized
      status: "True"
      reason: AllWorkSynced
      message: "All of the works are synchronized to the latest"
      lastTransitionTime: "2023-11-10T08:16:00Z"
      observedGeneration: 5
    - type: Applied
      status: "True"
      reason: AllWorkHaveBeenApplied
      message: "All corresponding work objects are applied"
      lastTransitionTime: "2023-11-10T08:16:15Z"
      observedGeneration: 5
    - type: Available
      status: "True"
      reason: ResourceAvailable
      message: "All resources are available on the target cluster"
      lastTransitionTime: "2023-11-10T08:16:30Z"
      observedGeneration: 5
    failedPlacements: []
    driftedPlacements: []
    diffedPlacements: []
  - clusterName: aks-west-2
    observedResourceIndex: "1"
    conditions:
    - type: ResourceScheduled
      status: "True"
      reason: ScheduleSucceeded
      message: "Successfully scheduled resources for placement in aks-west-2 (affinity score: 0, topology spread score: 0): picked by scheduling policy"
      lastTransitionTime: "2023-11-10T08:14:52Z"
      observedGeneration: 5
    - type: RolloutStarted
      status: "True"
      reason: RolloutStarted
      message: "Detected new changes on the resources and started the rollout process"
      lastTransitionTime: "2023-11-10T08:15:30Z"
      observedGeneration: 5
    - type: Overridden
      status: "True"
      reason: NoOverrideSpecified
      message: "No override rules are configured for the selected resources"
      lastTransitionTime: "2023-11-10T08:15:45Z"
      observedGeneration: 5
    - type: WorkSynchronized
      status: "True"
      reason: AllWorkSynced
      message: "All of the works are synchronized to the latest"
      lastTransitionTime: "2023-11-10T08:16:00Z"
      observedGeneration: 5
    - type: Applied
      status: "True"
      reason: AllWorkHaveBeenApplied
      message: "All corresponding work objects are applied"
      lastTransitionTime: "2023-11-10T08:16:15Z"
      observedGeneration: 5
    - type: Available
      status: "True"
      reason: ResourceAvailable
      message: "All resources are available on the target cluster"
      lastTransitionTime: "2023-11-10T08:16:30Z"
      observedGeneration: 5
    failedPlacements: []
    driftedPlacements: []
    diffedPlacements: []

Oto kompletny przykład pokazujący pełny stan „ResourcePlacement”.

apiVersion: placement.kubernetes-fleet.io/v1
kind: ResourcePlacement
metadata:
  name: web-app-placement
  namespace: web-app
  generation: 5
spec:
  resourceSelectors:
  - group: apps
    kind: Deployment
    name: web-server
    version: v1
  - group: ""
    kind: Service
    name: web-service
    version: v1
  policy:
    placementType: PickN
    numberOfClusters: 2
    affinity:
      clusterAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          clusterSelectorTerms:
          - matchLabels:
              region: us-west
status:
  conditions:
  - type: ResourcePlacementScheduled
    status: "True"
    reason: SchedulingPolicyFulfilled
    message: "found all the clusters needed as specified by the scheduling policy"
    lastTransitionTime: "2023-11-10T08:14:52Z"
    observedGeneration: 5
  - type: ResourcePlacementRolloutStarted
    status: "True"
    reason: RolloutStarted
    message: "All 2 cluster(s) start rolling out the latest resource"
    lastTransitionTime: "2023-11-10T08:15:30Z"
    observedGeneration: 5
  - type: ResourcePlacementOverridden
    status: "True"
    reason: NoOverrideSpecified
    message: "No override rules are configured for the selected resources"
    lastTransitionTime: "2023-11-10T08:15:45Z"
    observedGeneration: 5
  - type: ResourcePlacementWorkSynchronized
    status: "True"
    reason: SynchronizeSucceeded
    message: "All 2 cluster(s) are synchronized to the latest resources on the hub cluster"
    lastTransitionTime: "2023-11-10T08:16:00Z"
    observedGeneration: 5
  - type: ResourcePlacementApplied
    status: "True"
    reason: ApplySucceeded
    message: "The selected resources are successfully applied to 2 clusters"
    lastTransitionTime: "2023-11-10T08:16:15Z"
    observedGeneration: 5
  - type: ResourcePlacementAvailable
    status: "True"
    reason: ResourceAvailable
    message: "The selected resources in 2 cluster are available now"
    lastTransitionTime: "2023-11-10T08:16:30Z"
    observedGeneration: 5
  observedResourceIndex: "1"
  selectedResources:
  - group: apps
    kind: Deployment
    name: web-server
    version: v1
  - group: ""
    kind: Service
    name: web-service
    version: v1
  placementStatuses:
  - clusterName: aks-west-1
    observedResourceIndex: "1"
    conditions:
    - type: ResourceScheduled
      status: "True"
      reason: ScheduleSucceeded
      message: "Successfully scheduled resources for placement in aks-west-1 (affinity score: 0, topology spread score: 0): picked by scheduling policy"
      lastTransitionTime: "2023-11-10T08:14:52Z"
      observedGeneration: 5
    - type: RolloutStarted
      status: "True"
      reason: RolloutStarted
      message: "Detected the new changes on the resources and started the rollout process"
      lastTransitionTime: "2023-11-10T08:15:30Z"
      observedGeneration: 5
    - type: Overridden
      status: "True"
      reason: NoOverrideSpecified
      message: "No override rules are configured for the selected resources"
      lastTransitionTime: "2023-11-10T08:15:45Z"
      observedGeneration: 5
    - type: WorkSynchronized
      status: "True"
      reason: AllWorkSynced
      message: "All of the works are synchronized to the latest"
      lastTransitionTime: "2023-11-10T08:16:00Z"
      observedGeneration: 5
    - type: Applied
      status: "True"
      reason: AllWorkHaveBeenApplied
      message: "All corresponding work objects are applied"
      lastTransitionTime: "2023-11-10T08:16:15Z"
      observedGeneration: 5
    - type: Available
      status: "True"
      reason: ResourceAvailable
      message: "All resources are available on the target cluster"
      lastTransitionTime: "2023-11-10T08:16:30Z"
      observedGeneration: 5
    failedPlacements: []
    driftedPlacements: []
    diffedPlacements: []
  - clusterName: aks-west-2
    observedResourceIndex: "1"
    conditions:
    - type: ResourceScheduled
      status: "True"
      reason: ScheduleSucceeded
      message: "Successfully scheduled resources for placement in aks-west-2 (affinity score: 0, topology spread score: 0): picked by scheduling policy"
      lastTransitionTime: "2023-11-10T08:14:52Z"
      observedGeneration: 5
    - type: RolloutStarted
      status: "True"
      reason: RolloutStarted
      message: "Detected new changes on the resources and started the rollout process"
      lastTransitionTime: "2023-11-10T08:15:30Z"
      observedGeneration: 5
    - type: Overridden
      status: "True"
      reason: NoOverrideSpecified
      message: "No override rules are configured for the selected resources"
      lastTransitionTime: "2023-11-10T08:15:45Z"
      observedGeneration: 5
    - type: WorkSynchronized
      status: "True"
      reason: AllWorkSynced
      message: "All of the works are synchronized to the latest"
      lastTransitionTime: "2023-11-10T08:16:00Z"
      observedGeneration: 5
    - type: Applied
      status: "True"
      reason: AllWorkHaveBeenApplied
      message: "All corresponding work objects are applied"
      lastTransitionTime: "2023-11-10T08:16:15Z"
      observedGeneration: 5
    - type: Available
      status: "True"
      reason: ResourceAvailable
      message: "All resources are available on the target cluster"
      lastTransitionTime: "2023-11-10T08:16:30Z"
      observedGeneration: 5
    failedPlacements: []
    driftedPlacements: []
    diffedPlacements: []

W tym przykładzie pokazano:

  • Planowanie zakończone powodzeniem: mechanizm rozmieszczania znalazł dwa klastry spełniające zasady rozmieszczania.
  • Pomyślne wdrożenie: wszystkie zasoby zostały wdrożone w obu klastrach docelowych.
  • Brak zastąpień: Nie skonfigurowano żadnych zastąpień zasobów ani nie są one potrzebne.
  • Zsynchronizowana praca: obiekty robocze są tworzone i synchronizowane.
  • Zastosowane zasoby: wszystkie zasoby są pomyślnie stosowane.
  • Dostępne zasoby: wszystkie zasoby są uruchomione i dostępne.
  • Stan czyszczenia: brak nieudanych, dryfowanych lub różnicowych umieszczania.

Aby dowiedzieć się więcej na temat umieszczania zasobów, zobacz następujące artykuły: