Get all pods
kubectl get pods
Get pods in all namespaces
kubectl get pods --all-namespaces
Or shorthand:
kubectl get pods -A
Describe a pod
kubectl describe pod <pod-name>
View pod logs
kubectl logs <pod-name>
Follow logs (like tail -f)
kubectl logs -f <pod-name>
Execute command in pod
kubectl exec -it <pod-name> -- /bin/bash
Get deployments
kubectl get deployments
Scale deployment
kubectl scale deployment <deployment-name> --replicas=3
Get services
kubectl get svc
Port forward to local machine
kubectl port-forward pod/<pod-name> 8080:80
Delete pod
kubectl delete pod <pod-name>
Apply configuration
kubectl apply -f deployment.yaml
Get nodes
kubectl get nodes
Check cluster info
kubectl cluster-info