Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Questo articolo illustra come risolvere i problemi ClusterResourcePlacementApplied durante la propagazione delle risorse usando l'API ClusterResourcePlacement oggetto in Microsoft Azure Kubernetes Fleet Manager.
Sintomi
Quando si usa l'oggetto ClusterResourcePlacement API in Azure Kubernetes Fleet Manager per propagare le risorse, la distribuzione non riesce. Lo ClusterResourcePlacementApplied stato viene visualizzato come False.
Motivo
Questo problema può verificarsi a causa di uno dei motivi seguenti:
- La risorsa esiste già nel cluster e non è gestita dal controller della flotta. Per risolvere questo problema, aggiornare il file YAML manifest
ClusterResourcePlacementper usareAllowCoOwnershipinApplyStrategyper consentire al controller della flotta di gestire la risorsa. - Un'altra
ClusterResourcePlacementdistribuzione gestisce già la risorsa per il cluster selezionato usando una strategia di applicazione diversa. - La
ClusterResourcePlacementdistribuzione non applica il manifesto a causa di errori di sintassi o configurazioni di risorse non valide. Ciò può verificarsi anche se una risorsa viene propagata tramite un oggetto envelope.
Procedura di risoluzione dei problemi
- Visualizzare lo
ClusterResourcePlacementstato e individuare laplacementStatusessezione. Controllare ilplacementStatusesvalore per identificare quali cluster hanno laResourceAppliedcondizione impostata suFalsee prendere nota del relativoclusterNamevalore. - Individuare l'oggetto
Worknel cluster hub. Usare l'oggetto identificatoclusterNameper individuare l'oggettoWorkassociato al cluster membro. Per altre informazioni, vedere Come trovare la risorsa di lavoro corretta associata aClusterResourcePlacement. - Controllare lo stato dell'oggetto
Workper comprendere i problemi specifici che impediscono l'applicazione di risorse riuscita.
Caso di studio
Nell'esempio seguente, ClusterResourcePlacement sta cercando di propagare uno spazio dei nomi che contiene una distribuzione a due cluster membri. Tuttavia, lo spazio dei nomi esiste già in uno dei cluster membri, precisamente kind-cluster-1.
Le specifiche di 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
Stato di 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
Nella sezione failedPlacements per kind-cluster-1, i campi message spiegano perché la risorsa non è stata applicata al cluster membro. Nella sezione precedente conditions, la condizione Applied per kind-cluster-1 viene contrassegnata come false e mostra il motivo NotAllWorkHaveBeenApplied. Ciò indica che l'oggetto Work destinato al cluster kind-cluster-1 membro non è stato applicato. Per altre informazioni, vedere Come trovare la risorsa di lavoro corretta associata a ClusterResourcePlacement.
Stato operativo di 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
Controllare lo Work stato, in particolare la manifestConditions sezione . È possibile notare che il namespace non è stato applicato, ma la distribuzione all'interno del namespace è stata propagata dall'hub al cluster membro.
Risoluzione
In questa situazione, una potenziale soluzione consiste nell'impostare AllowCoOwnership su true nella policy ApplyStrategy. Tuttavia, è importante notare che questa decisione deve essere presa dall'utente perché le risorse potrebbero non essere condivise.
Inoltre, è possibile esaminare i log per l'applicazione del controller di lavoro per ulteriori informazioni sul motivo per cui le risorse non sono disponibili.
Contattaci per ricevere assistenza
In caso di domande, è possibile porre domande al supporto della community di Azure. È anche possibile inviare commenti e suggerimenti sul prodotto alla community di commenti e suggerimenti di Azure.