Kubernetes (kubectl) Cheat Sheet

A quick reference for common `kubectl` commands to manage your Kubernetes cluster.

CommandDescription
kubectl cluster-infoDisplay information about the master and services in the cluster.
kubectl versionDisplay the Kubernetes version running on the client and server.
kubectl get nodesList all nodes in the cluster.

CommandDescription
kubectl get podsList all pods in the current namespace.
kubectl get pods -n [namespace]List all pods in a specific namespace.
kubectl get pods -o wideList all pods with more details (e.g., node name).
kubectl get deploymentsList all deployments.
kubectl get servicesList all services.
kubectl describe pod [pod-name]Show detailed information about a specific pod.

CommandDescription
kubectl create -f [file.yaml]Create a resource from a YAML file.
kubectl delete pod [pod-name]Delete a pod.
kubectl exec -it [pod-name] -- /bin/shGet a shell to a running container.
kubectl logs [pod-name]Print the logs for a pod.
kubectl logs -f [pod-name]Stream the logs for a pod.