GCE 节点 Api 使用没有外部 IP 的自定义网络
GCE Node Api use custom network with no external IP
我很难通过节点 google 计算引擎 API 创建新的虚拟机。当没有选择外部 IP 时,云控制台给我 REST 代码:
"networkInterfaces": [
{
"subnetwork": "projects/optum-80593/regions/us-central1/subnetworks/subnet-us-central1"
}
]
但是当我在节点 API 的配置中使用它时,外部 IP 仍设置为该 VM:
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');
const config = {
machineType: machinetype,
maintenancePolicy: 'MIGRATE',
http: true,
disks: [
...
],
canIpForward: false,
networkInterfaces: [
{
subnetwork: "projects/optum-80593/regions/us-central1/subnetworks/subnet-us-central1"
}
],
...
}
await zone.createVM(vmName, config).then(async (data) => {
它有效,当我将整个 REST 代码复制到我的节点时 API。
我很难通过节点 google 计算引擎 API 创建新的虚拟机。当没有选择外部 IP 时,云控制台给我 REST 代码:
"networkInterfaces": [
{
"subnetwork": "projects/optum-80593/regions/us-central1/subnetworks/subnet-us-central1"
}
]
但是当我在节点 API 的配置中使用它时,外部 IP 仍设置为该 VM:
const Compute = require('@google-cloud/compute');
const compute = new Compute();
const zone = compute.zone('us-central1-a');
const config = {
machineType: machinetype,
maintenancePolicy: 'MIGRATE',
http: true,
disks: [
...
],
canIpForward: false,
networkInterfaces: [
{
subnetwork: "projects/optum-80593/regions/us-central1/subnetworks/subnet-us-central1"
}
],
...
}
await zone.createVM(vmName, config).then(async (data) => {
它有效,当我将整个 REST 代码复制到我的节点时 API。