eksctl spot instances

Alvais Gershon
1 min readMay 12, 2020

This is sample config file to enable and use spot instances in EKS and keep a majority.

This is useful for testing and saves money. In the following example, we will get 3 instances:

2 spot and 1 regular across 3 AZ

save this file as ‘cluster.yaml’ then run

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: spot-test
region: us-east-1
version: '1.15' # Without default is the current latest e.g 1.15

# cluster AZs must be set explicitly for single AZ nodegroup example to work
availabilityZones: ["us-east-1a", "us-east-1b", "us-east-1c"]
nodeGroups:
- name: nodegroup-1
minSize: 2
desiredCapacity: 3
maxSize: 5
volumeSize: 30
volumeType: gp2
volumeEncrypted: true
iam:
withAddonPolicies:
albIngress: true
autoScaler: true
tags:
nodegroup-role: worker
instancesDistribution:
maxPrice: 0.01
instanceTypes: ["t3a.small", "t3.medium"] # At least one instance type should be specified
onDemandBaseCapacity: 0
onDemandPercentageAboveBaseCapacity: 20
spotInstancePools: 3
secretsEncryption:
keyARN: arn:aws:kms:xxxxxxxxxxxxxxxxxxxxxxxxxxxx

save this file as ‘cluster.yaml’ then run

eksctl create cluster -f cluster.yaml

--

--