⚡ 100% In-Browser & Private: Your data never leaves your computer. Powered by Cloudflare Edge CDN.
ProWebTools PRO
Developer & SEO Utilities
DevOps Matrix

Kubectl & Kubernetes Commands Cheat Sheet

Production Kubernetes CLI reference: pod management, rolling restarts, port-forwarding, ingress, secrets decoding, and node resource monitoring with 1-click copy.

Pods & Workloads (7 commands)

Pods & Workloads
kubectl get pods -n <namespace>

Lists all pods running in the specified namespace with status, restarts, and age.

Pods & Workloads
kubectl get pods -o wide

Displays pod list along with assigned Pod IP address and host worker node.

Pods & Workloads
kubectl get pods -A

Retrieves all pods across every namespace in the Kubernetes cluster.

Pods & Workloads
kubectl describe pod <pod-name>

Shows deep diagnostics, container states, resource limits, and recent cluster events.

Pods & Workloads
kubectl logs -f <pod-name>

Streams live stdout/stderr logs from the primary container in the pod.

Pods & Workloads
kubectl exec -it <pod-name> -- /bin/sh

Opens an interactive terminal session inside the running container.

Pods & Workloads
kubectl delete pod <pod-name>

Terminates the specified pod. If managed by a Deployment, a new replica spawns automatically.

Deployments & Rollouts (5 commands)

Deployments & Rollouts
kubectl get deployments

Lists available deployments, desired vs ready replicas, and update status.

Deployments & Rollouts
kubectl scale deployment/<deployment-name> --replicas=5

Instantly increases or decreases the number of running pod replicas.

Deployments & Rollouts
kubectl rollout restart deployment/<deployment-name>

Performs a rolling restart of all pods in the deployment without downtime.

Deployments & Rollouts
kubectl rollout status deployment/<deployment-name>

Monitors the progress of a rolling deployment update until complete.

Deployments & Rollouts
kubectl rollout undo deployment/<deployment-name>

Reverts the deployment back to the previous revision if a bug is detected.

Services & Networking (3 commands)

Services & Networking
kubectl get svc

Shows all services, internal ClusterIPs, NodePorts, and LoadBalancer external IPs.

Services & Networking
kubectl port-forward svc/<service-name> 8080:80

Forwards local machine traffic on port 8080 directly to port 80 of the Kubernetes service.

Services & Networking
kubectl get ingress

Displays all configured HTTP/HTTPS Ingress rules, TLS hosts, and backend service routes.

ConfigMaps & Secrets (2 commands)

ConfigMaps & Secrets
kubectl get configmaps

Shows non-sensitive configuration keys stored in the active namespace.

ConfigMaps & Secrets
kubectl get secret <secret-name> -o jsonpath="{.data.<key>}" | base64 --decode

Extracts and decodes Base64-encoded secret keys directly in terminal.

Cluster & Nodes (3 commands)

Cluster & Nodes
kubectl top nodes

Shows current CPU cores and RAM consumption across all worker and control plane nodes.

Cluster & Nodes
kubectl top pods --sort-by=memory

Ranks pods by current RAM utilization to identify memory leak bottlenecks.

Cluster & Nodes
kubectl config use-context <context-name>

Switches kubectl target environment between local minikube, staging, and production.