Networking 如何解决;外部IP地址';IP地址、名称和x27;在“区域”中找不到;在GCP中
关于StackOverflow的第一个问题。请随时询问是否需要更多的上下文,并提前向您表示感谢 我正在建立一个由Google Compute Engine管理的实例组,它有两个要求:Networking 如何解决;外部IP地址';IP地址、名称和x27;在“区域”中找不到;在GCP中,networking,google-cloud-platform,vpc,Networking,Google Cloud Platform,Vpc,关于StackOverflow的第一个问题。请随时询问是否需要更多的上下文,并提前向您表示感谢 我正在建立一个由Google Compute Engine管理的实例组,它有两个要求: 简单的HTTPS配置。因此,将托管实例组与负载平衡器一起使用 第三方IP白名单的静态IP 我知道静态IP使其无法水平扩展,但在这种情况下这并不重要 我面临的问题是静态IP地址无法应用于实例组,因为GCE声明在该区域中找不到该名称。交易是,静态IP地址区域是europe-west4,托管组区域是europe-we
- 简单的HTTPS配置。因此,将托管实例组与负载平衡器一起使用
- 第三方IP白名单的静态IP李>
#[开始创建模板]
gcloud计算实例模板创建${TEMPLATE}\
--图像系列=${image_系列}\
--图像项目=${image\u project}\
--机器类型=${machine\u type}\
--范围=${scopes}\
--文件启动脚本中的元数据=${startup\u script}\
--标记${tags}\
--元数据桶=${BUCKET}\
--地址=${STATIC\u IP\u address\u NAME}
#[结束创建模板]
#创建托管实例组。
#[启动创建组]
gcloud计算实例组管理创建${GROUP}\
--基本实例名称${GROUP}\
--1号\
--模板${template}\
--欧洲西部4-a区
#[结束创建组]
预期的输出是创建一个具有静态出口IP地址的计算引擎
我得到以下错误
ERROR: (gcloud.compute.instance-groups.managed.create) Could not fetch resource:
- Invalid value for field 'resource.instanceTemplate': 'https://www.googleapis.com/compute/v1/projects/companyproject-test/global/instanceTemplates/service-name-group-tmpl'. Unable to create an instance from instanceTemplate service-name-group-tmpl in zone europe-west4-a:
Invalid value for field 'instance.networkInterfaces[0].accessConfigs[0].natIP': The specified external IP address 'STATIC_IP_ADDRESS_NAME' was not found in region 'europe-west4'
在静态外部IP地址的文档中,它们声明该区域或分区的资源可以使用静态IP地址。请参阅文档中的“”
此外,说明向单个实例模板添加地址的文档也是可能的 通过使用以下命令将静态IP地址分配给组中的单个实例,解决了此问题:
# Retrieve the single instance name and save it in a variable
instance=`gcloud compute instance-groups managed list-instances name-group --zone=europe-west4-a --format="value(instance.basename())"`
# Remove the existing external NAT of the instance
gcloud compute instances delete-access-config $instance \
--access-config-name "External NAT" \
--zone=$ZONE
# Add the new external NAT that has the static address
gcloud compute instances add-access-config $instance \
--access-config-name "External NAT" \
--address $IP_ADDRESS \
--zone=$ZONE
有两种类型的外部(静态)IP地址。全球和区域。如果要创建区域负载平衡器,则需要区域IP地址。对于全局HTTP负载平衡器,您需要一个全局IP地址。@JohnHanley它不能是该区域内的一个区域吗?一个用于什么的区域?我不明白你的评论。请重新阅读我的评论。为了澄清:我检索了实例组中的单个实例名称,而不是使用实例模板来设置IP地址。