Getting started with Amazon EKS –
eksctl
This guide helps you to create all of the required resources to get started with Amazon Elastic Kubernetes Service
(Amazon EKS) using eksctl
, a simple command line utility for creating and managing
Kubernetes clusters on Amazon EKS. At the end of this tutorial, you will have a running Amazon EKS
cluster that you can deploy applications to.
The procedures in this guide create several resources for you automatically that you have to create manually when you create your cluster using the AWS Management Console. If you'd rather manually create most of the resources to better understand how they interact with each other, then use the AWS Management Console to create your cluster and compute. For more information, see Getting started with Amazon EKS – AWS Management Console and AWS CLI.
Prerequisites
Before starting this tutorial, you must install and configure the following tools and resources that you need to create and manage an Amazon EKS cluster.
-
kubectl
– A command line tool for working with Kubernetes clusters. For more information, see Installing or updating kubectl. -
eksctl
– A command line tool for working with EKS clusters that automates many individual tasks. For more information, see Installing or updating eksctl. -
Required IAM permissions – The IAM security principal that you're using must have permissions to work with Amazon EKS IAM roles, service linked roles, AWS CloudFormation, a VPC, and related resources. For more information, see Actions, resources, and condition keys for Amazon Elastic Container Service for Kubernetes and Using service-linked roles in the IAM User Guide. You must complete all steps in this guide as the same user. To check the current user, run the following command:
aws sts get-caller-identity
Step 1: Create your Amazon EKS cluster and nodes
Important
To get started as simply and quickly as possible, this topic includes steps to create a cluster and nodes with default settings. Before creating a cluster and nodes for production use, we recommend that you familiarize yourself with all settings and deploy a cluster and nodes with the settings that meet your requirements. For more information, see Creating an Amazon EKS cluster and Amazon EKS nodes. Some settings can only be enabled when creating your cluster and nodes.
You can create a cluster with one of the following node types. To learn more about each type, see Amazon EKS nodes. After your cluster is deployed, you can add other node types.
-
Fargate – Linux – Select this type of node if you want to run Linux applications on AWS Fargate. Fargate is a serverless compute engine that lets you deploy Kubernetes Pods without managing Amazon EC2 instances.
-
Managed nodes – Linux – Select this type of node if you want to run Amazon Linux applications on Amazon EC2 instances. Though not covered in this guide, you can also add Windows self-managed and Bottlerocket nodes to your cluster.
Create your Amazon EKS cluster with the following command. You can replace
with your own value. The name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 100 characters. Replace
my-cluster
with any AWS Region that is supported by Amazon EKS.
For a list of AWS Regions, see Amazon EKS endpoints and quotas in the AWS General Reference guide.region-code
Cluster creation takes several minutes. During creation you'll see several lines of output. The last line of output is similar to the following example line.
[...]
[✓] EKS cluster "my-cluster" in "region-code
" region is ready
eksctl
created a kubectl
config
file in ~/.kube
or added the new cluster's
configuration within an existing config
file in ~/.kube
on
your computer.
After cluster creation is complete, view the AWS CloudFormation stack named
eksctl-
in the
AWS CloudFormation console at https://console.aws.amazon.com/cloudformationmy-cluster
-cluster
Step 2: View Kubernetes resources
-
View your cluster nodes.
kubectl get nodes -o wide
An example output is as follows.
For more information about what you see in the output, see View Kubernetes resources.
-
View the workloads running on your cluster.
kubectl get pods -A -o wide
An example output is as follows.
For more information about what you see in the output, see View Kubernetes resources.
Step 3: Delete your cluster and nodes
After you've finished with the cluster and nodes that you created for this tutorial, you should clean up by deleting the cluster and nodes with the following command. If you want to do more with this cluster before you clean up, see Next steps.
eksctl delete cluster --name
my-cluster
--regionregion-code
Next steps
The following documentation topics help you to extend the functionality of your cluster.
Deploy a sample application to your cluster.
The IAM principal that created the cluster is the only principal that can make calls to the Kubernetes API server with
kubectl
or the AWS Management Console. If you want other IAM principals to have access to your cluster, then you need to add them. For more information, see Enabling IAM principal access to your cluster and Required permissions.Before deploying a cluster for production use, we recommend familiarizing yourself with all of the settings for clusters and nodes. Some settings (such as enabling SSH access to Amazon EC2 nodes) must be made when the cluster is created.
To increase security for your cluster, configure the Amazon VPC Container Networking Interface plugin to use IAM roles for service accounts.