1.9. クラスターがすでに存在するというエラーのトラブルシューティング
OpenShift Container Platform クラスターを Red Hat Advanced Cluster Management MultiClusterHub にインポートできず、AlreadyExists エラーを受け取る場合は、手順に従って問題をトラブルシューティングします。
1.9.1. 以前の動作: OpenShift Container Platform クラスターをインポートするときにエラーログがすでに存在する リンクのコピーリンクがクリップボードにコピーされました!
OpenShift Container Platform クラスターを Red Hat Advanced Cluster Management MultiClusterHub にインポートすると、エラーログが表示されます。
error log:
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
Error from server (AlreadyExists): error when creating "STDIN": customresourcedefinitions.apiextensions.k8s.io "klusterlets.operator.open-cluster-management.io" already exists
The cluster cannot be imported because its Klusterlet CRD already exists.
Either the cluster was already imported, or it was not detached completely during a previous detach process.
Detach the existing cluster before trying the import again."
1.9.2. 問題の特定: OpenShift Container Platform クラスターのインポート時にすでに存在する リンクのコピーリンクがクリップボードにコピーされました!
以下のコマンドを実行して、新しい Red Hat Advanced Cluster Management MultiClusterHub にインポートする Red Hat Advanced Cluster Management 関連のリソースがクラスター上にあるかどうかを確認します。
oc get all -n open-cluster-management-agent
oc get all -n open-cluster-management-agent-addon
1.9.3. 問題の解決: OpenShift Container Platform クラスターのインポート時にすでに存在する リンクのコピーリンクがクリップボードにコピーされました!
次のコマンドを使用して、klusterlet カスタムリソースを削除します。
oc get klusterlet | grep klusterlet | awk '{print $1}' | xargs oc patch klusterlet --type=merge -p '{"metadata":{"finalizers": []}}'
次のコマンドを実行して、既存のリソースを削除します。
oc delete namespaces open-cluster-management-agent open-cluster-management-agent-addon --wait=false
oc get crds | grep open-cluster-management.io | awk '{print $1}' | xargs oc delete crds --wait=false
oc get crds | grep open-cluster-management.io | awk '{print $1}' | xargs oc patch crds --type=merge -p '{"metadata":{"finalizers": []}}'