概要
この記事では、Microsoft Azure Kubernetes Fleet Manager で配置 API を使用してリソースを伝達するときのリソースの可用性エラーのトラブルシューティング方法について説明します。 この問題は、 ClusterResourcePlacement と ResourcePlacementの両方に適用され、それぞれに独自のカスタム リソース条件の種類が適用されます。
-
ClusterResourcePlacementAvailableClusterResourcePlacement の場合 -
ResourcePlacementAvailableResourcePlacement の場合
サンプル エラー メッセージ:
- lastTransitionTime: "2024-05-07T23:32:40Z"
message: Failed to check the availability of resources in 1 clusters, please check the `failedPlacements` status
observedGeneration: 1
reason: ResourcesUnavailable
status: "False"
type: ClusterResourcePlacementAvailable
症状
Azure Kubernetes Fleet Manager で ClusterResourcePlacement または ResourcePlacement API オブジェクトを使用してリソースを伝達すると、デプロイは失敗します。
ClusterResourcePlacementAvailable (ClusterResourcePlacement の場合) または ResourcePlacementAvailable (ResourcePlacement の場合) の状態は、Falseとして表示されます。
注
リソースが使用できない理由の詳細については、作業アプライヤー コントローラー ログを確認してください。 詳細なエラーは、配置状態の failedPlacements セクションに表示されます。 フリート エージェント ログの表示の詳細については、「 Azure Kubernetes Fleet Manager でのエージェント ログの表示」を参照してください。
原因
この問題は、次のいずれかの理由で発生する可能性があります。
- メンバー クラスターに十分なリソースの可用性がありません。
- デプロイに無効なイメージ名が含まれています。
- 必要なリソース (永続ボリューム、構成マップ、シークレットなど) がありません。
- リソースのクォータまたは制限範囲によって、リソースが使用できなくなります。
ケース スタディ: ClusterResourcePlacement
次の例は、イメージ名が無効なため、 ClusterResourcePlacement がメンバー クラスターにデプロイを伝達できないことを示しています。
ClusterResourcePlacement の仕様
apiVersion: placement.kubernetes-fleet.io/v1beta1
kind: ClusterResourcePlacement
metadata:
name: crp
spec:
resourceSelectors:
- group: ""
kind: Namespace
name: test-ns
version: v1
policy:
placementType: PickN
numberOfClusters: 1
strategy:
type: RollingUpdate
ClusterResourcePlacement の状態
status:
conditions:
- lastTransitionTime: "2024-05-14T18:52:30Z"
message: found all cluster needed as specified by the scheduling policy, found
1 cluster(s)
observedGeneration: 1
reason: SchedulingPolicyFulfilled
status: "True"
type: ClusterResourcePlacementScheduled
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: All 1 cluster(s) start rolling out the latest resource
observedGeneration: 1
reason: RolloutStarted
status: "True"
type: ClusterResourcePlacementRolloutStarted
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: No override rules are configured for the selected resources
observedGeneration: 1
reason: NoOverrideSpecified
status: "True"
type: ClusterResourcePlacementOverridden
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Works(s) are succcesfully created or updated in 1 target cluster(s)'
namespaces
observedGeneration: 1
reason: WorkSynchronized
status: "True"
type: ClusterResourcePlacementWorkSynchronized
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: The selected resources are successfully applied to 1 cluster(s)
observedGeneration: 1
reason: ApplySucceeded
status: "True"
type: ClusterResourcePlacementApplied
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: The selected resources in 1 cluster(s) are still not available yet
observedGeneration: 1
reason: ResourceNotAvailableYet
status: "False"
type: ClusterResourcePlacementAvailable
observedResourceIndex: "0"
placementStatuses:
- clusterName: kind-cluster-1
conditions:
- lastTransitionTime: "2024-05-14T18:52:30Z"
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-14T18:52:31Z"
message: Detected the new changes on the resources and started the rollout process
observedGeneration: 1
reason: RolloutStarted
status: "True"
type: RolloutStarted
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: No override rules are configured for the selected resources
observedGeneration: 1
reason: NoOverrideSpecified
status: "True"
type: Overridden
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: All of the works are synchronized to the latest
observedGeneration: 1
reason: AllWorkSynced
status: "True"
type: WorkSynchronized
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: All corresponding work objects are applied
observedGeneration: 1
reason: AllWorkHaveBeenApplied
status: "True"
type: Applied
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Work object crp1-work isn't available
observedGeneration: 1
reason: NotAllWorkAreAvailable
status: "False"
type: Available
failedPlacements:
- condition:
lastTransitionTime: "2024-05-14T18:52:31Z"
message: Manifest is trackable but not available yet
observedGeneration: 1
reason: ManifestNotAvailableYet
status: "False"
type: Available
group: apps
kind: Deployment
name: my-deployment
namespace: test-ns
version: v1
selectedResources:
- kind: Namespace
name: test-ns
version: v1
- group: apps
kind: Deployment
name: my-deployment
namespace: test-ns
version: v1
failedPlacementsの kind-cluster-1 セクションの message フィールドには、リソースがメンバー クラスターに適用されなかった理由が説明されています。 前のconditionsセクションでは、Appliedのkind-cluster-1条件にfalseフラグが設定され、NotAllWorkHaveBeenApplied理由が表示されます。 メンバー クラスターWorkを対象としたkind-cluster-1 オブジェクトが適用されませんでした。 詳細については、「ClusterResourcePlacementに関連付けられている正しい Work リソースを見つける方法」を参照してください。
kind-cluster-1 の作業状態
status:
conditions:
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Work is applied successfully
observedGeneration: 1
reason: WorkAppliedCompleted
status: "True"
type: Applied
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Manifest {Ordinal:1 Group:apps Version:v1 Kind:Deployment Resource:deployments
Namespace:test-ns Name:my-deployment} is not available yet
observedGeneration: 1
reason: WorkNotAvailableYet
status: "False"
type: Available
manifestConditions:
- conditions:
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Manifest is already up to date
reason: ManifestAlreadyUpToDate
status: "True"
type: Applied
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Manifest is trackable and available now
reason: ManifestAvailable
status: "True"
type: Available
identifier:
kind: Namespace
name: test-ns
ordinal: 0
resource: namespaces
version: v1
- conditions:
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Manifest is already up to date
observedGeneration: 1
reason: ManifestAlreadyUpToDate
status: "True"
type: Applied
- lastTransitionTime: "2024-05-14T18:52:31Z"
message: Manifest is trackable but not available yet
observedGeneration: 1
reason: ManifestNotAvailableYet
status: "False"
type: Available
identifier:
group: apps
kind: Deployment
name: my-deployment
namespace: test-ns
ordinal: 1
resource: deployments
version: v1
Availableの状態をkind-cluster-1で確認します。
my-deploymentデプロイがまだメンバー クラスターで使用できないことを確認できます。 問題が配置マニフェストに影響している可能性があります。
解決策
問題の根本原因が正しくないイメージ名であることを示すメッセージが表示されるため、この状況では、メンバー クラスター内のデプロイを確認します。 イメージ名を特定したら、配置マニフェストを修正して更新します。 リソース マニフェストを修正して更新すると、配置オブジェクト (ClusterResourcePlacement または ResourcePlacement) によって、修正されたリソースがメンバー クラスターに自動的に伝達されます。
その他の状況では、伝達されたリソースが正しく構成されていることを確認してください。 さらに、選択したクラスターに、新しいリソースに対応できる十分な容量があることを確認します。
一般的なトラブルシューティングに関する注意事項
トラブルシューティング プロセスと作業オブジェクト検査は、両方の配置タイプで同じです。
- どちらも、基になる同じ Work API を使用して、メンバー クラスターにリソースを適用します。
- Work オブジェクトの状態と manifestConditions の構造は、作成した配置の種類に関係なく同じです。
- 作業状態の
Available条件は、適用されたリソースがメンバー クラスターで使用できるようになったかどうかを示します。 - 主な違いはスコープです。クラスター スコープの配置では、クラスター スコープリソースと名前空間スコープリソースの両方を選択できますが、名前空間スコープの配置では、独自の名前空間内の名前空間スコープのリソースのみを選択できます。