6.14.3. Google Cloud Filestore CSI Driver Operator のインストール
6.14.3.1. Workload Identity を使用して Google Cloud Filestore CSI Driver Operator をインストールする準備 リンクのコピーリンクがクリップボードにコピーされました!
GCP Workload Identity を Google Compute Platform Filestore とともに使用する予定の場合は、Google Cloud Filestore Container Storage Interface (CSI) Driver Operator のインストール中に使用する特定のパラメーターを取得する必要があります。
前提条件
- cluster-admin ロールを持つユーザーとしてクラスターにアクセスできる。
手順
Workload Identity を使用して Google Cloud Filestore CSI Driver Operator をインストールする準備をするには、以下を実行します。
プロジェクト番号を取得します。
以下のコマンドを実行してプロジェクト ID を取得します。
$ export PROJECT_ID=$(oc get infrastructure/cluster -o jsonpath='{.status.platformStatus.gcp.projectID}')以下のコマンドを実行し、プロジェクト ID を使用してプロジェクト番号を取得します。
$ gcloud projects describe $PROJECT_ID --format="value(projectNumber)"
ID プール ID とプロバイダー ID を検索します。
クラスターのインストール中に、これらのリソースの名前は、
--name parameterを使用して Cloud Credential Operator ユーティリティー (ccoctl) に渡されます。「Cloud Credential Operator ユーティリティーを使用した Google Cloud リソースの作成」を参照してください。Google Cloud Filestore Operator 用の Workload Identity リソースを作成します。
次のサンプルファイルを使用して
CredentialsRequestファイルを作成します。Credentials Request YAML ファイルの例
apiVersion: cloudcredential.openshift.io/v1 kind: CredentialsRequest metadata: name: openshift-gcp-filestore-csi-driver-operator namespace: openshift-cloud-credential-operator annotations: include.release.openshift.io/self-managed-high-availability: "true" include.release.openshift.io/single-node-developer: "true" spec: serviceAccountNames: - gcp-filestore-csi-driver-operator - gcp-filestore-csi-driver-controller-sa secretRef: name: gcp-filestore-cloud-credentials namespace: openshift-cluster-csi-drivers providerSpec: apiVersion: cloudcredential.openshift.io/v1 kind: GCPProviderSpec predefinedRoles: - roles/file.editor - roles/resourcemanager.tagUser skipServiceCheck: true次のコマンドを実行して、
CredentialsRequestファイルを使用して Google Cloud サービスアカウントを作成します。$ ./ccoctl gcp create-service-accounts --name=<filestore-service-account> \1 --workload-identity-pool=<workload-identity-pool> \2 --workload-identity-provider=<workload-identity-provider> \3 --project=<project-id> \4 --credentials-requests-dir=/tmp/credreq5 - 1
- <filestore-service-account> は、ユーザーが選択した名前です。
- 2
- <workload-identity-pool> は、上記のステップ 2 から取得されます。
- 3
- <workload-identity-provider> は、上記のステップ 2 から取得されます。
- 4
- <project-id> は上記のステップ 1.a から取得されます。
- 5
CredentialsRequestファイルが存在するディレクトリーの名前。出力例
2025/02/10 17:47:39 Credentials loaded from gcloud CLI defaults 2025/02/10 17:47:42 IAM service account filestore-service-account-openshift-gcp-filestore-csi-driver-operator created 2025/02/10 17:47:44 Unable to add predefined roles to IAM service account, retrying... 2025/02/10 17:47:59 Updated policy bindings for IAM service account filestore-service-account-openshift-gcp-filestore-csi-driver-operator 2025/02/10 17:47:59 Saved credentials configuration to: /tmp/install-dir/1 openshift-cluster-csi-drivers-gcp-filestore-cloud-credentials-credentials.yaml- 現在のディレクトリー。
次のコマンドを実行して、新しく作成されたサービスアカウントのサービスアカウントメールを見つけます。
$ cat /tmp/install-dir/manifests/openshift-cluster-csi-drivers-gcp-filestore-cloud-credentials-credentials.yaml | yq '.data["service_account.json"]' | base64 -d | jq '.service_account_impersonation_url'出力例
https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/filestore-se-openshift-g-ch8cm@openshift-gce-devel.iam.gserviceaccount.com:generateAccessTokenこの出力例では、サービスアカウントのメールは
filestore-se-openshift-g-ch8cm@openshift-gce-devel.iam.gserviceaccount.comです。
結果
これで、Google Cloud Filestore CSI Driver Operator をインストールするために必要な次のパラメーターの準備ができました。
- プロジェクト番号 - ステップ 1.b
- プール ID - ステップ 2
- プロバイダー ID - ステップ 2
- サービスアカウントのメールアドレス - ステップ 3.c