15.2. Cloud Credential Operator ユーティリティーを使用した GCP リソースの削除
GCP Workload Identity を使用し、手動モードで Cloud Credential Operator (CCO) を使用して OpenShift Container Platform クラスターをアンインストールした後にリソースをクリーンアップするには、CCO ユーティリティー (ccoctl) を使用してインストール時に ccoctl が作成した GCP リソースを削除します。
前提条件
-
ccoctlバイナリーをデプロイメントして準備します。 - GCP Workload Identity を使用して手動モードで CCO を使用して OpenShift Container Platform クラスターをインストールします。
手順
以下のコマンドを実行して、OpenShift Container Platform リリースイメージを取得します。
RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')$ RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下のコマンドを実行して、OpenShift Container Platform リリースイメージから
CredentialsRequestカスタムリソース (CR) のリストを抽出します。oc adm release extract --credentials-requests \ --cloud=gcp \ --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \ $RELEASE_IMAGE
$ oc adm release extract --credentials-requests \ --cloud=gcp \ --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \1 $RELEASE_IMAGECopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
credrequestsは、CredentialsRequestオブジェクトのリストが格納されるディレクトリーです。ディレクトリーが存在しない場合、このコマンドはディレクトリーを作成します。
ccoctlが作成した GCP リソースを削除します。ccoctl gcp delete \ --name=<name> \ --project=<gcp_project_id> \ --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests
$ ccoctl gcp delete \ --name=<name> \1 --project=<gcp_project_id> \2 --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequestsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
検証
- リソースが削除されたことを確認するには、GCP にクエリーを実行します。詳細は、GCP ドキュメントをご覧ください。