我正在尝试使用GKE创建集群。我有一个已经在使用的项目。
我跑步时
def config_device(computing_device):
if 'gpu' in computing_device:
device_number = computing_device.rsplit(':',1)[1]
os.environ["CUDA_VISIBLE_DEVICES"] = device_number
# with tf.device(computing_device):
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
# Currently,memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu,True)
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
print(len(gpus),"Physical GPUs,",len(logical_gpus),"Logical GPUs")
except RuntimeError as e:
# Memory growth must be set before GPUs have been initialized
print(e)
我得到以下信息:
错误:(gcloud.container.clusters.create)ResponseError:代码= 403,消息= Google Compute Engine:对“项目//全局/网络/默认”具有必需的“ compute.networks.get”权限。
当我使用Web UI时也会发生同样的事情。我的服务帐户和用户都具有所有者角色。
我尝试了以下方法来使集群创建命令起作用:
- 我尝试为现有服务帐户的项目添加策略绑定:
gcloud container clusters create cluster1
- 我读到启用容器api服务是必需的
gcloud projects add-iam-policy-binding <my-project> \
--member serviceaccount:<my-user>@<my-project>.iam.gserviceaccount.com \
--role roles/compute.admin
- 重新开始。我删除了服务帐户,创建了一个新帐户,并通过以下方式激活了凭据:
gcloud services enable container.googleapis.com
- 我还尝试了与我的帐户用户进行身份验证:
gcloud auth activate-service-account <my-user>@<my-project>.iam.gserviceaccount.com --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
这些都不起作用,我无法创建集群