'Spinnaker bakery error: Subnetwork should be specified for custom subnetmode network, invalid
I have installed Spinnaker version: 1.14.11 (local) from scratch on a GCP VM and did hal config. Spinnaker is able to see the compute instances and network in the project. Spinnaker also works fine creating server group / LB and firewall. but once I setup the pipeline to bake and deploy, it fails with the following error.
==> 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 config:
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 is a custom VPC network, where should I provide the Subnetwork? or how to fix this error?
Please advise.
Solution 1:[1]
Managed to resolved this issue by passing "gce_subnetwork" as an "Extended Attributes" under "Bake Configuration" in the pipeline.
Hope this might help some.
Solution 2:[2]
I had this error when attempting to create a compute instance using the gcloud compute CLI command.
Solution
My solution was to add the --subnet flag and the --zone flag with a zone value corresponding to the zone of the subnetwork:
Example Command
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gans |
| Solution 2 | Kent Bull |
