AWS EKS ASAP
EKS is a powerful CaaS solution for hosting k8s in AWS. Though setting up a cluster can be a convoluted task, this quick point of reference will help you strap on those elastic pants and get deploying. We'll first dive into what deploying EKS looks like and what additional resources are provisioned when a cluster to created.
When deploying EKS is important to understand the ecosystem in which it runs. An EKS deployment includes it's own VPC with six subnets, 3 public and 3 private dispersed across multiple AZs. One node group with two nodes will be deployed. The Kubeconfig file is stored at /home/cloudshell-user/.kube/config for remote administration access.
The default deployment method aims to provide cluster redudancy and isolation from an architecture perspective. For provisioning purposes, I'll be utilizing AWS CloudShell. Cloudshell is a quick and easy way to interact with the AWS CLI using tradional command line. There's also a service called Cloud9 which can be leveraged as an IDE if you'd prefer that route. Alright, now that you're sold on proceeding this far, steps for deployment are as follows:
1. Launch AWS CloudShell in your preferred region.
2. Download eksctl using the following command:
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
3. Move eksctl to the /home/cloudshell-user/bin directory for persistance purposes:
sudo mv /tmp/eksctl /home/cloudshell-user/bin
4. Create an indepedant key pair for connecting to EC2 nodes running within the EKS cluster:
aws ec2 create-key-pair --key-name eksKeyPair --query 'KeyMaterial' --output text > eksKeyPair.pem
5. Create your cluster! This process takes about 15-20 minutes at the time of this writing:
eksctl create cluster
6. Install kubectl (Check for a later version):
curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.23.7/2022-06-29/bin/linux/amd64/kubectl
7. Apply execution permission to kubectl:
chmod +x ./kubectl
8. Move kubectl to a different directory and add it to your path:
mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin
9. Add the $HOME/bin path to your shell start:
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
10. View your nodes with kubectl:
kubectl get nodes -o wide
Congrats! You're up and running, now comes the time to build. It's important to note you can use the AWS console for insight on your newly created EKS cluster. Below are some reference links to services and resources used: