Skip to content

Kubernetes cheat sheet

Connect kubectl to an EKS cluster by creating a kubeconfig file

Terminal window
aws sts get-caller-identity
Terminal window
aws eks update-kubeconfig --region region-code --name my-cluster

Restart a pod

  1. Rolling Restart of Deployment
Terminal window
kubectl rollout restart deployment <deployment_name>
  1. Scaling the Replica Count (Temporary scale to zero)

Scale down to zero

Terminal window
kubectl scale deployment <deployment_name> --replicas=0

Scale back up to the original number of replicas

Terminal window
kubectl scale deployment <deployment_name> --replicas=<original_number>