Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes service that makes it easy for you to run Kubernetes on AWS without needing to install, operate, and maintain your own Kubernetes control plane. Click for more details.
In order to set up a new Amazon EKS, we need an AWS account with root privileges. For the k8s interaction, we also need a client machine. I'll use MacOS for this article.
This is the first and most important step for our cluster setup. When I try to create VPC myself, I have encountered many errors. First of all, you need to decide on your cluster subnets. We have 3 choices. Public/Public&Private/Private. Detailed architecture is explained here.
I choose the Public & Private one. In this architecture, our control plane is accessible from the public internet, and our workers run in a private network.
To create VPC with cloudformation;
- Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.
- From the navigation bar, select a Region that supports Amazon EKS.
- Choose Create a stack, With new resources (standard).
- For Choose a template, select Specify an Amazon S3 template URL.
- Paste the URL that corresponds to the Region that your cluster is in into the text area and choose Next:
Now we can continue with the installation. Select EKS from the service list. Give a name to your cluster. Select the K8s version and Service Role and then press next.
Select previously created VPC, Subnet and Security group from the current screen. Don't forget to select Public & Private from the Cluster endpoint access section.
On the next screen, you can choose your favourite infra options or leave it off-state.
Congratulations! You have created your EKS cluster.
EKS Node Group Creation
You have successfully deployed EKS but you need worker nodes. For this requirement, you need to select Compute tab from your EKS dashboard and click the Add Node Group button.
After you select the name and Node IAM Role, click next and select the machine types and scaling configurations.
We need to select the subnet and ssh options from the last screen.
After a few seconds, the nodes will have been created and joined the master.
AWS & Eksctl Setup
If you want to control your cluster with kubectl you need aws cli. Ok, but what is eksctl?
Ekscli is a simple CLI tool for creating clusters on EKS - Amazon's new managed Kubernetes service for EC2. It is written in Go, uses CloudFormation, was created by Weaveworks and welcomes contributions from the community.
Why we did previous step? because I did want to explain what is under the hood.
Let's install eksctl;
brew tap weaveworks/tap
brew tap weaveworks/tap
brew upgrade eksctl && brew link
Let's install awscli;
brew install awscli
(I assume you have already installed kubectl if not click here)
In order to create a kubeconfig file we need to configure awscli
To create kubeconfig;
aws eks --region [your region code] update-kubeconfig --name [your cluster name]
After these steps, you have successfully configured your kubectl.
After configuring your awscli you can create an EKS cluster with ekscli :)
eksctl create cluster
eksctl read your awscli configuration and create a cluster for you with default settings.
We completed EKS cluster installation. Feel free to discover your newly created EKS Cluster.