Hi everyone! Looking to find out how to provision ...
# google-cloud
c
Hi everyone! Looking to find out how to provision a GKE cluster with spot instances. I've looked through the docs but can't seem to find it in the api. I've noticed it is documented in the AWS sdk so just want to know if it's possible for gcp as well. Thanks!
h
I believe spot VMs are known as preemptible nodes on a GKE cluster and you set this option on the nodePool. Heres a short example of a nodepool in typescript:
Copy code
const nodePool = new NodePool(args.nodePoolName, {
    cluster: cluster.id,
    nodeCount: args.nodesPerZone,
    maxPodsPerNode: args.maxPodsPerNode,
    nodeConfig: {
      preemptible: true,
      machineType: args.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/cloud-platform>",
      ],
      workloadMetadataConfig: {
        mode: "GKE_METADATA"
      }
    },
  });
👍 1
c
Thanks for this! 🙂
1