尝试使用部署管理器将虚拟机部署到名为"MyNet“的自定义VPC网络,只是不知道如何将我的自定义VPC网络放入yaml文件中,也希望使用固态硬盘而不是标准的持久盘。
resources:
- name: vm
type: compute.v1.instance
properties:
zone: northamerica-northeast1-a
machineType: zones/northamerica-northeast1-a/machineTypes/f1-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: projects/centos-cloud/global/images/family/centos-7
networkInterfaces:
- network: global/networks/default
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT发布于 2019-07-07 17:54:10
你可以看看this example explaining how to create two VMs and a custom network with Google Deployment Manager。在这个存储库中,您还可以找到其他可能有用的示例。
无论如何,对于您的特定问题:要创建自定义VPC网络,请使用:
- name: my-custom-network
type: compute.v1.network
properties:
routingConfig:
routingMode: REGIONAL
autoCreateSubnetworks: true检查the REST reference of network resource以查找所有可能的参数。
要引用您的自定义网络和并使用固态硬盘代替虚拟机的标准磁盘,请执行以下操作:
中disks.initializeParams.diskType属性一节中的自定义网络
最后,对于您的VM,您应该这样写:
- name: vm
type: compute.v1.instance
properties:
zone: northamerica-northeast1-a
machineType: zones/northamerica-northeast1-a/machineTypes/f1-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: projects/centos-cloud/global/images/family/centos-7
diskType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/northamerica-northeast1-a/diskTypes/pd-ssd
networkInterfaces:
- network: $(ref.my-custom-network.selfLink)
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT对于磁盘,请注意disks[0].initializeParams.diskType属性末尾的pd-ssd,而不是pd-standard (默认值)。检查REST reference of instance resource中的其他参数。
https://stackoverflow.com/questions/56914888
复制相似问题