Easily create an EKS cluster in AWS using eksctl

3 minute read

For me, not a while ago, Kubernetes cluster administration and creation in AWS was synonymous with kops as their cloud build Kubernetes service (EKS) was lacking features and was a handful when it came to creating and administrating a cluster. Since then things took a turn for the best, new tools were developed and made creation and administration of an EKS clusters more pleasant.
Such a tool is eksctl created and maintained by Weaveworks. Eksctl is a CLI tool built in GO that helps with creation of AWS EKS clusters.
You can easily create a cluster using eksctl with a simple command line instruction where you can specify the name, Kubernetes version, AWS region, the name of the worker nodegroup, EC2 machine node-type, number of nodes from the get go, a minimum number and a maximum number of nodes for autoscalling purposes and if you want the node group to be managed and provisioned by AWS EKS which you certainly want to:

    eksctl create cluster \
    --name prod \
    --version 1.14 \
    --region eu-central-1 \
    --nodegroup-name prod_node_group \
    --node-type t3.large \
    --nodes 2 \
    --nodes-min 1 \
    --nodes-max 3 \
    --managed

If you are an adept of IAC (Infrastructure as code) you can in depth customize your cluster by using a yaml config file:

apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: prod
  region: eu-central-1
  version: 1.14

managedNodeGroups:
  - name: prod
    instanceType: t3.large
    desiredCapacity: 1
    availabilityZones: ["eu-central-1a"]
    minSize: 1
    maxSize: 3
    tags:
          nodegroup-role: worker
    labels: {role: worker}
    iam:
      withAddonPolicies:
        externalDNS: true
        certManager: true

The config above is similar to the CLI instruction but it also adds new options for customization like specifying availabilityZones, addons policies and many more, a full list of features can be found at eksctl homepage.

The yaml config can be easily applied using: eksctl create cluster -f cluster.yaml.

EndPost

Eksctl is a great tool that simplifies cluster creation and even Amazon recommends using it in their official documentation.