为什么 gcloud 命令在项目设置上失败?

huangapple go评论53阅读模式
英文:

Why gcloud command fails on project settings

问题

你当前的项目已设置为:[myproject-1]。

错误:(gcloud.init) 失败的命令:[compute zones describe us-east1],退出代码为[1]

有人能帮忙解释为什么我会收到这个错误吗?我试图重新初始化 gcloud auth init,当我设置项目编号时,我收到上述错误。我需要将项目区域更改为另一个区域吗?

谢谢,
Ashish

英文:
Your current project has been set to: [myproject-1].

```bash
ERROR: (gcloud.init) Failed command: [compute zones describe us-east1] with exit code [1]

Can someone help with why I am getting this error? I am trying to reinitialize gcloud auth init and when I set the project number, I receive the above error. Do I need to change the project region to another region?

Thanks,
Ashish

答案1

得分: 1

错误消息表明在 gcloud 尝试定义 us-east1 时出现问题,该地区不是一个区域而是一个区域。正确的命令来定义该地区应该是:

gcloud compute regions describe us-east1

如果您想要设置默认区域,您可以将 us-east1-bus-east1-c 作为示例。

您可以使用以下命令设置默认字段。

gcloud config set number/location[zone]

示例命令:

gcloud config set number/location us-east1-b

如果问题仍然存在,请检查您是否具有项目所需的适当角色和权限。

英文:

The error message indicates a problem when gcloud tries to define us-east1, which is a region and not a zone. The correct command to define the region would be

gcloud compute regions describe us-east1

If you are trying to set a default zone, you may put us-east1-b or us-east1-c as an example.

You can set the default field with the following command.

gcloud config set number/location[zone]

example command:

gcloud config set number/location us-east1-b

If the issue persists, please check if you have the proper roles and permissions for the project.

答案2

得分: 0

@JohnHanley 当然,我会保持我的帖子具有标准输入和标准输出,我的帐户拥有所有者和编辑角色,以下是如何使用元数据更新区域的方法:

> gcloud compute project-info add-metadata \
>     --metadata google-compute-default-region=us-west2,google-compute-default-zone=europe-west1-b
英文:

@JohnHanley Sure , I will keep my post with standard input and standard output, My Account had Owner & Editor roles, Here is how to update zone using metadata

> gcloud compute project-info add-metadata \
>     --metadata google-compute-default-region=us-west2,google-compute-default-zone=europe-west1-b

huangapple
  • 本文由 发表于 2023年6月16日 03:56:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76485126.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定