我一直试图使用Deployment-manager在GCP中部署regionInstanceGroupManager,但是在创建部署时出现错误
我为InstanceGroupManager使用Jinja2模板,为instanceTemplate使用一个模板。
instance-group-template.jinja:
resources:
- name: {{ env["name"] }}
type: compute.v1.regionInstanceGroupManager
properties:
region: {{ properties["region"] }}
targetSize: 4
instanceTemplate: {{ properties["instanceTemplate"] }}
baseInstanceName: {{ env["name"] }}
distributionPolicy:
zones:
- zone: {{ properties["region"] }}-a
- zone: {{ properties["region"] }}-b
instance-template.jinja文件:
resources:
- name: {{ env["name"] }}
type: compute.v1.instanceTemplate
properties:
machineType: n1-standard-1
zone: {{ properties["zone"] }}
networkInterfaces:
- network: {{ properties["network"] }}
subnetwork: {{ properties["subnetwork"] }}
accessConfigs:
- type: ONE_TO_ONE_NAT
name: external-nat
disks:
- type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-10-buster-v20191014
config.yaml:
imports:
- path: templates/compute/instance-group-template.jinja
name: instance-group-template.jinja
- path: templates/compute/instance-template.jinja
name: instance-template.jinja
resources:
# Create instance template
- name: instance-template
type: instance-template.jinja
properties:
zone: europe-west2-a
network: $(ref.network.selfLink)
subnetwork: $(ref.subnet.selfLink)
# Create instance group
- name: instance-group
type: instance-group-template.jinja
properties:
instanceTemplate: instance-template
region: europe-west2
我得到的错误代码是:
Invalid value for field 'resource.properties': ''. Instance Templates must provide instance properties