Spinnaker bakery error: Subnetwork should be specified for custom subnetmode network, invalid

Spinnaker bakery error: Subnetwork should be specified for custom subnetmode network, invalid

我已经在 GCP VM 上从头开始安装了 Spinnaker 版本:1.14.11(本地)并进行了 hal 配置。 Spinnaker 能够看到项目中的计算实例和网络。 Spinnaker 也可以很好地创建服务器组/LB 和防火墙。但是一旦我将管道设置为烘焙和部署,它就会失败并出现以下错误。

==> googlecompute: Checking image does not exist...
==> googlecompute: Creating temporary SSH key for instance...
==> googlecompute: Using image: ubuntu-1604-xenial-v20190628
==> googlecompute: Creating instance...
    googlecompute: Loading zone: us-east1-b
    googlecompute: Loading machine type: n1-standard-1
    googlecompute: Requesting instance creation...
==> googlecompute: Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[0]': '{  "network": "projects/pg-us-p-app-xxxx/global/networks/devops",  "accessConfig": [{    "type": "...'. Subnetwork should be specified for custom subnetmode network, invalid
Build 'googlecompute' errored: Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[0]': '{  "network": "projects/pg-us-p-app-xxxx/global/networks/devops",  "accessConfig": [{    "type": "...'. Subnetwork should be specified for custom subnetmode network, invalid

==> Some builds didn't complete successfully and had errors:
--> googlecompute: Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[0]': '{  "network": "projects/pg-us-p-app-xxxx/global/networks/devops",  "accessConfig": [{    "type": "...'. Subnetwork should be specified for custom subnetmode network, invalid

==> Builds finished but no artifacts were created.


gcloud compute networks list  | grep devops
devops                       CUSTOM       REGIONAL

HAL 配置:


google:
      enabled: true
      accounts:
      - name: my-gce-account
        requiredGroupMembership: []
        providerVersion: V1
        permissions: {}
        project: pg-us-p-app-xxxx
        jsonPath: /home/spinnaker/.gcp/gce.json
        alphaListed: false
        imageProjects: []
        consul:
          enabled: false
          agentEndpoint: localhost
          agentPort: 8500
          datacenters: []
      primaryAccount: my-gce-account
      bakeryDefaults:
        templateFile: gce.json
        baseImages: []
        zone: us-east1-b
        network: "devops"
        useInternalIp: true

devops是自定义VPC网络,我应该在哪里提供子网?或者如何解决这个错误?

请指教

通过将 "gce_subnetwork" 作为管道中 "Bake Configuration" 下的 "Extended Attributes" 传递,设法解决了此问题。

希望这对一些人有所帮助。

我在尝试使用 gcloud compute CLI 命令创建计算实例时遇到此错误。

解决方案

我的解决方案是添加 --subnet 标志和 --zone 标志,其区域值对应于子网的区域:

示例命令

gcloud compute instances import kbull-instance2022 \
  --os=debian-9 \
  --network=bull \
  --subnet=pen \
  --zone=us-east1-a \
  --source-uri=gs://bull-pen-image/bull-image-virtualbox.ova \
  --custom-cpu=2 \
  --custom-memory=2048MB