Hi, I am trying to create a regional cluster that ...
# google-cloud
a
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
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
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
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
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
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
no problem, it was to be sure the thread was not forgotten. Thanks