eksctl dramatically simplifies the creation of AWS EKS clusters, by providing a simple command-line interface.

Step 1 – Define a Cluster YAML

You can either create a file called ekscluster.yaml and place the YAML in, or run the following command which will create a file called ekscluster.yaml and automatically add the default YAML configuration for you.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cat << EOF > ekscluster.yaml
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: eksworkshop-eksctl
  region: ${AWS_REGION}
  version: "1.19"

availabilityZones: ["${AZS[0]}", "${AZS[1]}", "${AZS[2]}"]

managedNodeGroups:
- name: nodegroup
  desiredCapacity: 3
  instanceType: t3.small
  ssh:
    enableSsm: true

# To enable all of the control plane logs, uncomment below:
# cloudWatch:
#  clusterLogging:
#    enableTypes: ["*"]

secretsEncryption:
  keyARN: ${MASTER_ARN}
EOF

Step 2 – Create the EKS Cluster

Tell the eksctl tool to create a new cluster using the ekscluster.yaml.

1
eksctl create cluster -f ekscluster.yaml