Creating a Kubernetes Cluster on AWS using eksctl
What you need before trying this out,
- a free-tier AWS account on which your user has the necessary permissions on IAM.
- an access key for the above mention account which can be downloaded from AWS Console
- AWS CLI 2 configured on your machine using aws configure — eksctl will use the same config file to authenticate and execute later on
The Easy Way
The simplest way by far — all you need is only one command!
Installing k8s-cli and eksctl on MacOS (homebrew)
brew install kubernetes-cli
brew tap weaveworks/tap
brew install weaveworks/tap/eksctl
Once you have it installed, run
eksctl create cluster# you can customize the cluster creation by passing in parameters like soeksctl create cluster --name=test-eks-cluster --nodes=2 --region=eu-west-1
and that is all that is needed, keep in mind that this does the following for you
- Sets Region & AZ’s automatically
- Creates necessary subnets
- Creates a NodeGroup
- Selects a kubernetes version
- Calls CloudFormation in the background to bring up the worker nodes and attach them to the cluster
- Stores the kubeconfig file at /Users/<username>/.kube/config
Once this is done, you can simply run kubectl commands,
kubectl get namespaces
The Hard Way
The hard method is to either use Terraform or to do it from the GUI/AWS Cli — I shall be covering this very soon in another article.