首页 > 解决方案 > GCP:通过 gcloud 命令列出但未描述的实例

问题描述

以下怎么可能?

➢  gcloud compute instances list
NAME                                                 ZONE        MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP  STATUS
my-instance-1  us-east4-a  n1-standard-8               10.16.22.11               RUNNING
my-instance-2  us-east4-a  n1-standard-8               10.16.22.12               RUNNING
my-instance-3  us-east4-a  n1-standard-8               10.16.22.13               RUNNING
(.venv)
~/Workspace/staging-env-configs  workablestg9 ✔                                                                                 1h40m
➢  gcloud compute instances describe my-instance-1
ERROR: (gcloud.compute.instances.describe) Could not fetch resource:
 - The resource 'projects/my-project/zones/us-central1-b/instances/my-instance-1' was not found

(.venv)

标签: google-cloud-platformgoogle-compute-enginegcloud

解决方案


如果您的实例在默认区域“us-central1-b”中运行,您可以简单地执行gcloud compute instances describe <instance-name>但是,如果您的实例未在默认区域中运行,您还必须提供该区域,以便您执行以下操作:

gcloud compute instances describe my-instance-1 --zone us-east4-a

如果您查看输出:“资源 'projects/my-project/zones/us-central1-b/instances/my-instance-1'” 您可以清楚地看到它正在您的默认区域 us-central1-b 中查找


推荐阅读