Skip to content

Instantly share code, notes, and snippets.

@frutik
Last active June 17, 2021 08:27
Show Gist options
  • Save frutik/ac5e06c90072bfcb6053e6882f5fa933 to your computer and use it in GitHub Desktop.
Save frutik/ac5e06c90072bfcb6053e6882f5fa933 to your computer and use it in GitHub Desktop.

Kubernetes for Dummies (aka 101)

Macos X

Install/Setup

brew install kubernetes-cli
pip3 install awscli --upgrade
aws configure  (you have to specify credentials)
aws eks --region eu-west-1 update-kubeconfig --name eks-master

List services

kubectl get svc

List all running pods

kubectl get pods

Go inside a specific container with bash session

kubectl exec -it <POD_NAME> /deploy/docker-entrypoint.sh  bash

Go inside a specific container when pod is run more than one container

kubectl exec -it <POD_NAME> --container taxi-nginx-shops-ae sh

Check what version is running

kubectl describe deployment/taxi

Follow logs

kubectl logs -f <POD_NAME>

When you want to figure out why the previous container terminated

kubectl logs mypod --previous

Check to what cluster we are connected

kubectl config get-contexts

Kill pod

kubectl delete pod <POD_NAME> --grace-period=0 --force

Scale deployment

kubectl scale deployment counter --replicas=2

Tools

brew tap johanhaleby/kubetail && brew install kubetail
kubetail <SERVICE_NAME>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment