0
votes

I am creating a yaml config to deploy a gke cluster with multi-node-pool. I like to be able to create a new cluster and put each node-pool in a different subnetwork. Can this be done.

I have tried putting the subnetwork in different part of the properties under the second node-pool but it errors out. Below is the following error.

message: '{"ResourceType":"gcp-types/container-v1:projects.locations.clusters.nodePools","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message":"Invalid JSON payload received. Unknown name \"subnetwork\": Cannot find field.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"description":"Invalid JSON payload received. Unknown name \"subnetwork\": Cannot find field."}]}],"statusMessage":"Bad

The current code for the both node-pools. first node is creates but second one error out.

resources:
- name: myclus
  type: gcp-types/container-v1:projects.locations.clusters
  properties:
    parent: projects/[PROJECT_ID]/locations/[ZONE/REGION]
    cluster:
      name: my-clus
      zone: us-east4
      subnetwork: dev-web   ### leave this field blank if using the default network
      initialClusterVersion: "1.13"
      nodePools:
      - name: my-clus-pool1
        initialNodeCount: 1
        config:
          machineType: n1-standard-1
          imageType: cos
          oauthScopes:
            - https://www.googleapis.com/auth/cloud-platform
          preemptible: true
- name: my-clus
  type: gcp-types/container-v1:projects.locations.clusters.nodePools
  properties:
    parent: projects/[PROJECT_ID]/locations/[ZONE/REGION]/clusters/$(ref.myclus.name)
    subnetwork: dev-web   ### leave this field blank if using the default
    nodePool:
      name: my-clus-pool2
      initialNodeCount: 1
      version: "1.13"
      config:
        machineType: n1-standard-1
        imageType: cos
        oauthScopes:
          - https://www.googleapis.com/auth/cloud-platform
        preemptible: true

I like the expected out come to have 2 node-pools in 2 different subnetworks.

1
I see that I have "dev-web" in both node-pool but when change it to a different subnetwork it still errors out.k2swat

1 Answers

1
votes

I found out that this is actually not a limitation of Deployment Manager but a limitation of GKE.

We can’t assign a different subnet to different node pools, the network and subnets are defined at the cluster level. There is no “Subnetwork” field in the node pool API.

Here is a link you can refer to for more information.