Update gcp-ts-gke-serviceaccount/index.ts
MODIFY
gcp-ts-gke-serviceaccount/index.ts
gcp-ts-gke-serviceaccount/index.ts
@@ -29,18 +29,35 @@ const serviceAccountKey = new gcp.serviceAccount.Key("serviceAccount-key", {
// Create a GKE cluster
const cluster = new gcp.container.Cluster(name, {
- initialNodeCount: 2,
+ // We can't create a cluster with no node pool defined, but we want to only use
+ // separately managed node pools. So we create the smallest possible default
+ // node pool and immediately delete it.
+ initialNodeCount: 1,
+ removeDefaultNodePool: true,
+
minMasterVersion: masterVersion,
- nodeVersion: masterVersion,
+});
+
+const nodePool = new gcp.container.NodePool(`primary-node-pool`, {
+ cluster: cluster.name,
+ initialNodeCount: 2,
+ location: cluster.location,
nodeConfig: {
+ preemptible: true,
machineType: machineType,
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",
- ],
+ "https://www.googleapis.com/auth/monitoring"
+ ]
},
+ version: masterVersion,
+ management: {
+ autoRepair: true,
+ }
+}, {
+ dependsOn: [cluster]
});
// Export the Cluster name

Update gcp-ts-gke-serviceaccount/index.ts