Basic Commands⌗
kubectl get podsList all pods in the current namespace
kubectl get deploymentsList all deployments in the current namespace
kubectl get servicesList all services in the current namespace
kubectl get nodesList all nodes in the cluster
kubectl createCreate a resource (e.g., pod, deployment)
kubectl deleteDelete a resource (e.g., pod, deployment)
kubectl describeGet detailed information about a resource
kubectl logsView the logs of a pod
kubectl execExecute a command in a running pod
kubectl apply -fApply a configuration file
kubectl port-forwardForward a local port to a pod
kubectl scale –replicas=Scale a resource to a specified number of replicas
Advanced Commands⌗
kubectl create secretCreate a secret from literal values or a file
kubectl get -o yamlGet the YAML representation of a resource
kubectl editEdit a resource in a text editor
kubectl rolloutManage rollouts and rollbacks for a resource
kubectl explainGet detailed information about a resource type
kubectl topDisplay resource usage (CPU/memory)
kubectl cluster-infoDisplay cluster information
kubectl config viewView the current Kubernetes configuration
kubectl apply –dry-run -fDry run to see what resources would be created or modified
kubectl proxyStart a proxy to the Kubernetes API server
kubectl create nsCreate a new namespace
kubectl config use-contextSet the current context in the kubeconfig file
kubectl exec -it – /bin/bashOpen an interactive shell inside a pod
Additional Resources⌗
- Official kubectl Documentation: kubectl Cheat Sheet
- Kubernetes Reference Documentation: Kubernetes Documentation