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 setup 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 explained here.
I choose Public & Private one. In this architecture, our control plane 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 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 service list. Give a name to your cluster. Select K8s version and Service Role and than 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 favorite infra options or leave it off state.
Congratulations! You have created your EKS cluster.
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 subnet and ssh options from the last screen.
After a few seconds, the nodes will have been created and joined the master.
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 it welcomes contributions from the community.
Why we did previous step? because i did want to explain what is under 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 configured your awscli you can create a 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.