Kubectl Commands
Quick reference for common kubectl commands.
Cluster Info
kubectl cluster-info
kubectl get nodes
kubectl get namespacesPods
kubectl get pods -o wide
kubectl describe pod <pod-name>
kubectl logs <pod-name> -f
kubectl exec -it <pod-name> -- /bin/sh
kubectl delete pod <pod-name>Deployments
kubectl get deployments
kubectl describe deployment <name>
kubectl scale deployment <name> --replicas=3
kubectl rollout status deployment <name>
kubectl rollout history deployment <name>
kubectl rollout undo deployment <name>Services
kubectl get svc
kubectl describe svc <name>
kubectl get endpoints <name>Debugging
kubectl get events --sort-by='.lastTimestamp'
kubectl top pods
kubectl top nodes
kubectl port-forward <pod-name> 8080:80Useful Aliases
alias k=kubectl
alias kgp='kubectl get pods'
alias kgs='kubectl get svc'
alias kgd='kubectl get deployments'
alias kd='kubectl describe'
alias kx='kubectl exec -it'