Google cloud platform 在Google Cloud dataproc中使用非默认服务帐户
我想创建一个在非默认服务帐户下运行的dataproc集群。以下内容适用于计算实例:Google cloud platform 在Google Cloud dataproc中使用非默认服务帐户,google-cloud-platform,google-cloud-dataproc,Google Cloud Platform,Google Cloud Dataproc,我想创建一个在非默认服务帐户下运行的dataproc集群。以下内容适用于计算实例: gcloud compute instances create instance-1 --machine-type "n1-standard-1" --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" gcloud da
gcloud compute instances create instance-1 --machine-type "n1-standard-1" --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform"
gcloud dataproc clusters create --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" testdataproc12345
但在创建dataproc实例时,相同的--scopes
参数失败:
gcloud compute instances create instance-1 --machine-type "n1-standard-1" --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform"
gcloud dataproc clusters create --zone "europe-west1-b" --scopes xxxxxxxx@yyyyyyyy.iam.gserviceaccount.com="https://www.googleapis.com/auth/cloud-platform" testdataproc12345
错误:(gcloud.dataproc.clusters.create)无效的服务帐户作用域:'xxxxxxxxx@yyyyyyyy.iam.gserviceaccount.com='
是否可以在非默认服务帐户下运行dataproc?不幸的是,目前无法使用正常的“作用域和元数据”中介身份验证设置指定自定义服务帐户。然而,这是一个已知的特性请求,因此它应该在未来的Dataproc更新中可用 同时,即使您在使用Dataproc时无法使用默认GCE服务帐户禁用“存储读/写”作用域的存在,您也可以通过keyfiles让Hadoop端使用特定的服务帐户,方法是使用页面下的“创建密钥”选项为您的服务帐户获取JSON密钥文件,然后做两件事:
--properties core:fs.gs.auth.service.account.json.keyfile=/etc/hadoop/conf/my-service-account.json
#!/bin/bash
# Save this somewhere as gs://somepath/my-keyfile-setup.sh
gsutil cp gs://path/to/your/json/file/in/gcs/my=service-account.json \
/etc/hadoop/conf/my-service-account.json
然后应用该初始化操作:
gcloud dataproc clusters create --initialization-actions gs://somepath/my-keyfile-setup.sh ...