1.8. 이미 존재하는 클러스터 문제 해결 오류

OpenShift Container Platform 클러스터를 Red Hat Advanced Cluster Management MultiClusterHub 로 가져올 수 없고 AlreadyExists 오류가 발생하면 절차를 수행하여 문제를 해결합니다.

1.8.1. 증상: OpenShift Container Platform 클러스터를 가져올 때 Already exists 오류 로그

Red Hat Advanced Cluster Management MultiClusterHub 로 OpenShift Container Platform 클러스터를 가져올 때 오류 로그가 표시됩니다.

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.8.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.8.3. 문제 해결: OpenShift Container Platform 클러스터를 가져올 때 Already exists

다음 명령을 실행하여 기존 리소스를 제거합니다.

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": []}}'