Roadmap › Kubernetes (K8s) & AKS › Module: Deploying and Operating
Lessons in this course (15)

11. kubectl essentials

Basic★ Must knowLesson 11 of 15
bash
kubectl get nodes
kubectl get pods -n shop -o wide
kubectl get deploy,svc,ingress -A
kubectl describe pod shop-api-7d9f8-abcde -n shop       # events: scheduling, image pulls, probe failures
kubectl logs shop-api-7d9f8-abcde -n shop [-c api] [--previous] [-f]
kubectl exec -it shop-api-7d9f8-abcde -n shop -- sh
kubectl apply -f k8s/                                   # declarative create/update
kubectl delete -f k8s/deployment.yaml
kubectl scale deploy shop-api --replicas=5 -n shop
kubectl set image deploy/shop-api api=myacr.azurecr.io/shop-api:1.4.3 -n shop
kubectl rollout status deploy/shop-api -n shop
kubectl rollout history deploy/shop-api -n shop
kubectl rollout undo deploy/shop-api -n shop [--to-revision=3]
kubectl port-forward svc/shop-api 8080:80 -n shop
kubectl top pods -n shop                                 # needs metrics-server
kubectl get events -n shop --sort-by=.lastTimestamp
kubectl config get-contexts / use-context aks-prod
kubectl explain deployment.spec.strategy