Elastic Kubernetes Service workspace guide
Setting up your local workspace for working with AWS/EKS and Kubernetes
This is a quick and dirty copy+paste guide for getting up and running with what I believe are the essential tools for working with AWS/EKS and Kubernetes. Here I’m assuming you’re using Ubuntu but the official install guide links are provided below to cater to Mac / Linux $(distro) / Windows, as per your preferred environment.
Install AWS CLI v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"-o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Install EKSCTL
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl version
Install KubeCtl
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl # Version 1.21.x
curl -o kubectl.sha256 https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl.sha256
# This should return "0" if the checksums are the same, otherwise it will print the difference (which there shouldn't be!)
diff <(openssl sha1 -sha256 /usr/bin/kubectl|awk '{print $2}') <(cat kubectl.sha256 | awk '{print $1}') && echo $?
chmod +x ./kubectl
sudo mv kubectl /usr/bin/
kubectl version --short --client
Install Helm
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
Install Terraform
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt install terraform
Getting logged in and adding some shortcuts
Use aws configure to log in, you’ll need your AWS ID and Secret Key as well as the default region you’ll be working in (see here
)
use kubectl config get-contexts to see what clusters you can now work with, don’t worry if it’s empty that just means there are no clusters in that region, typical if you’re starting from scratch.
Add some cli auto-completion (assuming you’re using bash)
sudo apt install bash-completion
# Add these to your .bashrc file:
source <(kubectl completion bash)
complete -F __start_kubectl k
Here are some aliases (shortcuts) I like to add to my bashrc file:
alias whoami-aws='aws sts get-caller-identity'
alias k='kubectl'
alias kgn='kubectl get nodes'
alias kgnw='kubectl get nodes -o wide'
alias kgp='kubectl get pods'
alias kdp='kubectl describe pods'
alias kdn='kubectl describe nodes'
alias kgc='kubectl get cronjobs'
alias kgd='kubectl get deployments'
Interesting extra tools
https://github.com/derailed/k9s/releases
https://github.com/rebuy-de/aws-nuke