You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kubernetes is a container orchestration platform used to automate deployment, scaling, and lifecycle management of containerized applications.
Below is a curated list of essential kubectl commands useful for daily DevOps and platform engineering tasks.
1. Cluster & Context Management
Command
Description
kubectl version --short
Display client and server versions
kubectl cluster-info
Show Kubernetes master and service endpoints
kubectl config view
View kubeconfig configuration
kubectl config get-contexts
List all available contexts
kubectl config use-context <context-name>
Switch context between clusters
kubectl get nodes
List worker and control plane nodes
2. Pods
Command
Description
kubectl get pods
List pods in the current namespace
kubectl get pods -A
List pods across all namespaces
kubectl describe pod <pod-name>
Show detailed information about a pod
kubectl logs <pod-name>
Retrieve logs from a pod
kubectl logs <pod-name> -c <container-name>
Retrieve logs from a specific container
kubectl exec -it <pod-name> -- /bin/bash
Open interactive shell inside a pod
kubectl delete pod <pod-name>
Delete a pod
3. Deployments
Command
Description
kubectl create deployment <name> --image=<image>
Create a deployment
kubectl get deployments
List deployments
kubectl describe deployment <name>
Show deployment details
kubectl scale deployment <name> --replicas=<num>
Scale a deployment
kubectl set image deployment/<name> <container>=<image>