https://pulumi.com logo
#google-cloud
Title
# google-cloud
a

ambitious-engine-26999

09/27/2021, 7:59 AM
Hi, I am trying to create a regional cluster that spread only on 2 zones something that can be done with : gcloud container clusters create manualtest --machine-type n1-standard-4 --num-nodes 1 --enable-autoscaling --max-nodes 4 --min-nodes 0 --region europe-west3 --node-locations europe-west3-a,europe-west3-b when doing so with pulumi (TypeScript) it spreads on the 3 zones either default nodepool or with "removeDefaultNodePool" a separate one.
p

prehistoric-activity-61023

09/27/2021, 11:27 AM
are you sure you’re creating a zonal cluster with additional zone instead of regional cluster?
please share the code, especially the value of
location
arg passed to
gcp.container.Cluster
a

ambitious-engine-26999

09/27/2021, 12:16 PM
i do not want a zonal (or multi zonal cluster) i want a regional one with node pool only in certains zones here is a sample
const masterVersion="1.20.10-gke.301"
const nodesVersion="1.20.10-gke.301"
const masterMachineType="e2-medium"
const nodeMachineType="n1-standard-4"
const region = "europe-west3"
export const zones = [region + "-a", region + "-b"]
// Create the GKE cluster and export it.
export const k8sCluster = new gcp.container.Cluster("gke-cluster", {
minMasterVersion: masterVersion,
removeDefaultNodePool: false,
location: region,
nodePools:[{
initialNodeCount: 1,
nodeLocations: zones,
nodeConfig: {
preemptible: true,
machineType: masterMachineType,
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>",
],
},
version: masterVersion,
management: {
autoRepair: true,
autoUpgrade: true,
},
}],
});
`const nodePool = new gcp.container.NodePool(
worker-node-pool
, {`
cluster: k8sCluster.name,
autoscaling: {
minNodeCount: 1,
maxNodeCount: 4,
},
location: k8sCluster.location,
nodeLocations: zones,
nodeConfig: {
preemptible: true,
machineType: nodeMachineType,
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>",
],
},
version: nodesVersion,
management: {
autoRepair: true,
autoUpgrade: false,
},
}, {
dependsOn: [k8sCluster],
});
p

prehistoric-activity-61023

09/27/2021, 1:19 PM
Got it. I actually thought it’s not possible to have a regional cluster with node pools in only 2 zones but I had a quick look at the docs and indeed, it should be possible.
a

ambitious-engine-26999

09/27/2021, 1:58 PM
yes , i totally understand tfor contol plane to keep Qurom but for worker nodes it whould be possible (and necessary if you add autoscaling in the loop 😉 )
Hi @prehistoric-activity-61023, do you know if it is something doable with pulumi?
p

prehistoric-activity-61023

10/01/2021, 12:05 PM
Sorry, I didn’t have time to look into this but I remember about this thread. I’ll get back to you when I have some news.
a

ambitious-engine-26999

10/01/2021, 12:23 PM
no problem, it was to be sure the thread was not forgotten. Thanks
10 Views