How to make a regional cluster in GKE w/ deployment-manager?

12/12/2018

"zone" is a required field when I try to create but it says in the documentation that it is "deprecated". This is kinda misleading. Then everytime I include "zone". It is the one followed; Let us say I put "asia-east2-a" then it will be a zonal where the master node is in asia-east2-a.

Below is my jinja template

resources:
- name: practice-gke-clusters
  type: container.v1.cluster
  properties:
    zone: asia-east2-a
    cluster:
      name: practice-gke-clusters
      location: asia-east2
      network: $(ref.practice-gke-network.selfLink)
      subnetwork: $(ref.practice-gke-network-subnet-1.selfLink)
      nodePools:
        - name: default-pool
          config:
            machineType: n1-standard-1
            diskSizeGb: 10
            diskType: pd-ssd
            preemptible: True
            oauthScopes:
              - https://www.googleapis.com/auth/compute
              - https://www.googleapis.com/auth/devstorage.read_only
              - https://www.googleapis.com/auth/logging.write
              - https://www.googleapis.com/auth/monitoring
          initialNodeCount: 1
          autoscaling:
            enabled: True
            minNodeCount: 1
            maxNodeCount: 100
          management:
            autoUpgrade: False
            autoRepair: True
      loggingService: logging.googleapis.com
      monitoringService: monitoring.googleapis.com
-- Dean Christian Armada
google-cloud-platform
google-deployment-manager
google-kubernetes-engine

1 Answer

12/12/2018

Currently v1 API does not support the creation of regional clusters. However you can use v1beta1 API which supports this feature and use the following resource type:

type: gcp-types/container-v1beta1:projects.locations.clusters

Rather than using the 'zone' or 'region' key in the YAML, you would instead use a parent property that includes locations.

So your YAML would look something like this (replace PROJECT_ID and REGION with your own).

resources:
- type:  gcp-types/container-v1beta1:projects.locations.clusters  # previously container.v1.clusters
  name: source-cluster
  properties:
   parent: projects/PROJECT_ID/locations/REGION
   cluster:
     name: source
     initialNodeCount: 3
-- shamma
Source: StackOverflow