Getting started with Amazon EKS – eksctl - Amazon EKS
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

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 Amazon Web Services Management Console. If you'd rather manually create most of the resources to better understand how they interact with each other, then use the Amazon Web Services Management Console to create your cluster and compute. For more information, see Getting started with Amazon EKS – Amazon Web Services Management Console and Amazon 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. This guide requires that you use version 1.22 or later. For more information, see Installing kubectl.

  • eksctl – A command line tool for working with EKS clusters that automates many individual tasks. This guide requires that you use version 0.103.0 or later. For more information, see Installing eksctl.

  • Required IAM permissions – The IAM security principal that you're using must have permissions to work with Amazon EKS IAM roles and service linked roles, Amazon CloudFormation, and 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.

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.

Create your Amazon EKS cluster with the following command. You can replace my-cluster with your own value. The cluster name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters. Replace region-code with any Amazon Web Services Region that is supported by Amazon EKS. For a list of Amazon Web Services Regions, see Amazon EKS endpoints and quotas in the Amazon General Reference guide.

Managed nodes – Linux
eksctl create cluster --name my-cluster --region 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 Amazon CloudFormation stack named eksctl-my-cluster-cluster in the Amazon CloudFormation console at https://console.amazonaws.cn/cloudformation to see all of the resources that were created.

Step 2: View Kubernetes resources

  1. View your cluster nodes.

    kubectl get nodes -o wide

    The example output is as follows.

    Managed nodes – Linux
    NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME ip-192-168-12-49.region-code.compute.internal Ready <none> 6m7s v1.22.9-eks-d1db3c 192.168.12.49 52.35.116.65 Amazon Linux 2 5.4.156-83.273.amzn2.x86_64 docker://20.10.7 ip-192-168-72-129.region-code.compute.internal Ready <none> 6m4s v1.22.9-eks-d1db3c 192.168.72.129 44.242.140.21 Amazon Linux 2 5.4.156-83.273.amzn2.x86_64 docker://20.10.7

    For more information about what you see in the output, see View Kubernetes resources.

  2. View the workloads running on your cluster.

    kubectl get pods -A -o wide

    The example output is as follows.

    Managed nodes – Linux
    NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES kube-system aws-node-6ctpm 1/1 Running 0 7m43s 192.168.72.129 ip-192-168-72-129.region-code.compute.internal <none> <none> kube-system aws-node-cbntg 1/1 Running 0 7m46s 192.168.12.49 ip-192-168-12-49.region-code.compute.internal <none> <none> kube-system coredns-559b5db75d-26t47 1/1 Running 0 14m 192.168.78.81 ip-192-168-72-129.region-code.compute.internal <none> <none> kube-system coredns-559b5db75d-9rvnk 1/1 Running 0 14m 192.168.29.248 ip-192-168-12-49.region-code.compute.internal <none> <none> kube-system kube-proxy-l8pbd 1/1 Running 0 7m46s 192.168.12.49 ip-192-168-12-49.region-code.compute.internal <none> <none> kube-system kube-proxy-zh85h 1/1 Running 0 7m43s 192.168.72.129 ip-192-168-72-129.region-code.compute.internal <none> <none>

    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 --region region-code

Next steps

The following documentation topics help you to extend the functionality of your cluster.