Update GCP GKE example
Replace default node pool with a new node pool resource
MODIFY
gcp-ts-gke/cluster.ts
gcp-ts-gke/cluster.ts
@@ -7,19 +7,37 @@ import { masterVersion, nodeCount, nodeMachineType, password, username } from ".
// Create the GKE cluster and export it.
export const k8sCluster = new gcp.container.Cluster("gke-cluster", {
- initialNodeCount: nodeCount,
- nodeVersion: masterVersion,
+ // 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,
masterAuth: { username, password },
+
+});
+
+const nodePool = new gcp.container.NodePool(`primary-node-pool`, {
+ cluster: k8sCluster.name,
+ initialNodeCount: nodeCount,
+ location: k8sCluster.location,
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",
- ],
+ "https://www.googleapis.com/auth/monitoring"
+ ]
},
+ version: masterVersion,
+ management: {
+ autoRepair: true,
+ }
+}, {
+ dependsOn: [k8sCluster]
});
// Manufacture a GKE-style Kubeconfig. Note that this is slightly "different" because of the way GKE requires

Update GCP GKE example

Replace default node pool with a new node pool resource