Amazon EKS — Install kubectl & Helm

2 minute read

Install kubectl & Helm

kubectl is the Kubernetes command-line tool — you’ll use it every day to deploy apps, check status, and debug issues. Helm is the Kubernetes package manager — it installs complex applications (like the AWS Load Balancer Controller) with one command.


Install kubectl

macOS

$ brew install kubectl

Or manually:

$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
$ chmod +x kubectl
$ sudo mv kubectl /usr/local/bin/

Linux

$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ chmod +x kubectl
$ sudo mv kubectl /usr/local/bin/

Windows

choco install kubernetes-cli

Verify kubectl

$ kubectl version --client
Client Version: v1.29.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

Install Helm

macOS

$ brew install helm

Linux

$ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Windows

choco install kubernetes-helm

Verify Helm

$ helm version
version.BuildInfo{Version:"v3.14.3", GitCommit:"...", GitTreeState:"clean", GoVersion:"go1.21.8"}

What is kubectl?

kubectl — Your Kubernetes Swiss Army Knife
┌─────────────────────────────────────────────┐
│                                             │
│  kubectl get pods      → List running pods  │
│  kubectl apply -f      → Deploy from YAML   │
│  kubectl logs          → View container logs│
│  kubectl exec          → Shell into a pod   │
│  kubectl describe      → Detailed resource  │
│  kubectl delete        → Remove resources   │
│                                             │
│  All commands go through:                   │
│  kubectl → kubeconfig → API Server → Cluster│
│                                             │
└─────────────────────────────────────────────┘

What is Helm?

Think of Helm as apt or brew for Kubernetes:

# Without Helm (deploy AWS LB Controller):
$ kubectl apply -f service-account.yaml
$ kubectl apply -f cluster-role.yaml
$ kubectl apply -f cluster-role-binding.yaml
$ kubectl apply -f deployment.yaml
$ kubectl apply -f service.yaml
# 5+ files, each 50+ lines, version-specific

# With Helm (same thing):
$ helm install aws-load-balancer-controller \
    eks/aws-load-balancer-controller \
    -n kube-system \
    --set clusterName=my-cluster
# One command, handles all resources

kubectl Aliases (Time Saver)

Add these to your ~/.zshrc or ~/.bashrc:

alias k='kubectl'
alias kgp='kubectl get pods'
alias kga='kubectl get all'
alias kd='kubectl describe'
alias kl='kubectl logs'
alias kaf='kubectl apply -f'

Enable kubectl Shell Completion

Bash

$ echo 'source <(kubectl completion bash)' >> ~/.bashrc
$ source ~/.bashrc

Zsh

$ echo 'source <(kubectl completion zsh)' >> ~/.zshrc
$ source ~/.zshrc

Common Mistakes

Mistake Fix
kubectl version mismatch kubectl should be within ±1 minor version of cluster
Helm 2 installed Make sure you have Helm 3 (helm version should show v3.x)
No kubeconfig kubectl won’t work until you connect to a cluster
Multiple kubeconfig contexts Use kubectl config get-contexts to check which cluster you’re targeting

Quick Reference

# Install (macOS)
$ brew install kubectl helm

# Verify
$ kubectl version --client
$ helm version

# Enable completion
$ source <(kubectl completion zsh)
$ source <(helm completion zsh)

# Useful kubectl commands
$ kubectl config get-contexts    # List cluster connections
$ kubectl config use-context X   # Switch cluster
$ kubectl cluster-info           # Current cluster info

What’s Next?

Tools are installed! Now let’s set up the IAM permissions: IAM Setup.