DEV Community

loading...

From Zero to Creating an Amazon EKS Kubernetes Cluster with Eksctl

caleb_loomis profile image Caleb Loomis ・3 min read

AWS and Kubernetes can be intimidating at times, and setting up K8s clusters manually can lead to headaches if not properly configured. Luckily, eksctl allows you to create your own EKS cluster in a matter of minutes without headache or hassle. In this guide, we will install the necessary command line tools and create a Kubernetes cluster on AWS

What is Kubernetes?

Kubernetes is open-source software that allows you to manage and deploy any number of containers. For a simple explanation of containers and Kubernetes clusters, see the Illustrated Children's Guide to Kubernetes.

Installing AWS CLI

First, we need to install Amazon's command-line tool that allows us to set up and configure AWS services from the command line. These install directions come from AWS Documentation.

Installing on Linux

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "aws.zip"
unzip aws.zip
sudo ./aws/install
Enter fullscreen mode Exit fullscreen mode

Installing on Windows

Download and run the .msi installer for AWS CLI here

Installing on Mac

Download and run the .pkg installer for AWS CLI here

Configuring AWS CLI

Once you have aws installed, you will need to configure it to communicate with your aws account. In order to do that, you will need to log into your aws management console, and under IAM settings you will need to get an access key and secret key.

Once you have that, run the command

aws configure
Enter fullscreen mode Exit fullscreen mode

and respond to each of the the prompts appropriately.

Installing kubectl

kubectl is Kubernetes' command-line tool that allows you to manage your Kubernetes clusters. Kubernetes documentation has a pretty good overview of the things that you can do using kubectl here. For more options for installing kubectl, refer to the documentation here

Installing on Debian-based linux

sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2 curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
Enter fullscreen mode Exit fullscreen mode

Installing with Centos/Redhat/Fedora

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
yum install -y kubectl
Enter fullscreen mode Exit fullscreen mode

Installing with choco on Windows

To install kubectl using the chocolatey package manager:

choco install kubernetes-cli
Enter fullscreen mode Exit fullscreen mode

Installing using homebrew on Mac

To install kubectl using the homebrew package manager

brew install kubectl
Enter fullscreen mode Exit fullscreen mode

Installing eksctl

eksctl is a CLI for creating and managing Amazon EKS clusters.

Installing eksctl on Linux

curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
Enter fullscreen mode Exit fullscreen mode

Installing with choco on Windows

To install eksctl using the chocolatey package manager:

choco install eksctl
Enter fullscreen mode Exit fullscreen mode

Installing using homebrew on Mac

To install eksctl using the homebrew package manager

brew tap weaveworks/tap
brew install weaveworks/tap/eksctl
Enter fullscreen mode Exit fullscreen mode

At this point, we are ready to spin up our AWS Cluster

eksctl create cluster
Enter fullscreen mode Exit fullscreen mode

Will create a brand new cluster with a random name and two m5.large worker nodes.

Congratulations! You have created your first EKS cluster. From here, you might want to read more on the eksctl documentation or look into AWS's recommended next steps

Discussion (0)

pic
Editor guide