Google Cloud Deployment Manager:通过 yaml 配置将实例添加到实例组

KrH*_*ert 4 google-compute-engine google-cloud-platform google-cloud-sdk

我正在尝试通过部署管理器配置(YAML 文件)创建一个包含多个虚拟机的非托管实例组。

我可以通过 Google API 轻松找到有关addInstances 的文档,但找不到有关如何在 YAML 文件中执行此操作的文档:

实例

实例组

实例/实例组资源中应包含哪些属性才能使其正常工作?

小智 5

下面的 YAML 将创建一个计算引擎实例,创建一个非托管实例组,并将该实例添加到该组中。

resources:
- name: instance-1
  type: compute.v1.instance
  properties:
    zone: australia-southeast1-a
    machineType: zones/australia-southeast1-a/machineTypes/n1-standard-1
    disks:
    - deviceName: boot
      type: PERSISTENT
      diskType: zones/australia-southeast1-a/diskTypes/pd-ssd
      boot: true
      autoDelete: true
      initializeParams:
        sourceImage: projects/debian-cloud/global/images/debian-9-stretch-v20180716
    networkInterfaces:
    - network: global/networks/default
      accessConfigs:
      - name: External NAT
        type: ONE_TO_ONE_NAT

- name: ig-1
  type: compute.v1.instanceGroup
  properties:
    zone: australia-southeast1-a
    network: global/networks/default

- name: ig-1-members
  action: gcp-types/compute-v1:compute.instanceGroups.addInstances
  properties:
    project: YOUR_PROJECT_ID
    zone: australia-southeast1-a
    instanceGroup: ig-1
    instances: [ instance: $(ref.instance-1.selfLink) ]
Run Code Online (Sandbox Code Playgroud)