eksctl

Running eksctl on LocalStack to create EKS clusters

Introduction

eksctl is a CLI tool for creating and managing EKS clusters, Amazon’s managed Kubernetes service. LocalStack supports running eksctl on LocalStack to create EKS clusters locally. LocalStack’s EKS spin up embedded Kubernetes clusters using K3s to allow you to use the EKS APIs in your local environment.

Getting started

This guide is designed for users new to eksctl and running EKS clusters with LocalStack. Start LocalStack using your preferred method. We will demonstrate how you can create a local EKS cluster using eksctl and fetch the nodes in the cluster.

Pre-requisites

Create a cluster

To create a cluster, you can use the eksctl create cluster command. You can use the --profile flag to specify the LocalStack profile to use for the cluster.

Run the following command to create a cluster:

$ eksctl create cluster --nodes 1 --profile localstack
export AWS_CLOUDFORMATION_ENDPOINT=http://localhost.localstack.cloud:4566
export AWS_EC2_ENDPOINT=http://localhost.localstack.cloud:4566
export AWS_EKS_ENDPOINT=http://localhost.localstack.cloud:4566
export AWS_ELB_ENDPOINT=http://localhost.localstack.cloud:4566
export AWS_ELBV2_ENDPOINT=http://localhost.localstack.cloud:4566
export AWS_IAM_ENDPOINT=http://localhost.localstack.cloud:4566
export AWS_STS_ENDPOINT=http://localhost.localstack.cloud:4566

eksctl create cluster --nodes 1

Get the nodes

You can use the kubectl command to get the nodes in the cluster:

$ kubectl get nodes
Last modified August 28, 2024: update the eksctl command (#1452) (da501465e)