DevOps CLI Cheat Sheet & Explorer
Interactive command search and explorer for Kubectl, Docker Engine, and Docker Compose with live variable substitution.
Kubectl & Docker Command Explorer
Quickly search, inspect, and copy critical commands across Kubernetes, Docker, and Docker Compose. Type your active namespace, pod, or container names in the variable bar to customize commands on the fly.
Kubectl & Docker Cheat Sheet Explorer
Search, filter, and customize commands in real-time with dynamic variable substitution and flag explanations.
List Pods with Node & IP Details
List all running and pending pods in the specified namespace with IP, assigned node, and readiness status.
-nTarget namespace-o wideDisplays Node, IP, and readinessList Pods Across Entire Cluster
Query all pods across all namespaces simultaneously. Crucial for cluster-wide health checks.
-A / -all-namespacesScans all namespacesFind Unhealthy & Crashing Pods
Filter only pods that are not in the "Running" state (e.g. CrashLoopBackOff, Pending, Error).
--field-selectorFilter by server-side resource fieldsDeep Inspect Pod & Lifecycle Events
Displays container state, exit codes, volume mounts, resource limits, and event history for diagnosing crashes.
Force Kill Stuck Terminating Pod
Immediately terminate a stuck pod with zero grace period. Use with caution in production.
--grace-period=0Zero delay before SIGKILL--forceBypass API confirmation delayZero-Downtime Rolling Restart of Deployment
Trigger a rolling restart of all pods in a Deployment without changing the deployment spec.
Track Deployment Rollout Progress
Block and watch until the deployment update finishes or fails with a timeout.
Rollback Deployment to Previous Revision
Instantly revert a bad deployment to the previous stable replica set revision.
Manually Scale Deployment Replicas
Increase or decrease the replica count of an active deployment.
--replicasTarget desired replica countStream Live Logs (Follow & Tail)
Continuously stream real-time logs with the latest 100 lines for immediate debugging.
-fStream logs continuously--tailNumber of recent lines to displayView Logs of Crashed/Terminated Container
Retrieve the logs from the previous instance of a pod that died or was OOMKilled.
-p / --previousInspect logs from previous terminated container-cSpecify container inside multi-container podInteractive Shell Inside Running Pod
Open an interactive sh/bash terminal session inside a container.
-iPass stdin to container-tAllocate TTY (pseudo-terminal)Forward Local Port to Pod or Service
Access internal cluster applications, Redis, or databases directly from your localhost browser.
View Pod CPU & Memory Resource Metrics
Inspect live CPU millicores and memory megabytes usage using Metrics Server.
--sort-bySort output by memory or cpuAttach Ephemeral Debug Container to Distroless Pod
Attach a debug container equipped with curl, netstat, and bash to a stripped distroless pod.
Decode Secret Value Directly to Plaintext
Extract and decode base64 Kubernetes Secret data keys directly on the CLI.
-o jsonpathExtract specific JSON attributesCreate Generic Secret from Literal Values
Quickly create a Kubernetes secret without manually encoding in base64.
Generate YAML Manifest via Client-Side Dry Run
Generate starter Kubernetes manifest YAML without applying it to the cluster.
--dry-run=clientRun locally without cluster contact-o yamlOutput clean YAML manifestView Node CPU & RAM Consumption
Quickly identify overworked or bottlenecked worker nodes in your cluster.
Drain Node Safely for Maintenance
Evict all running pods from a node so it can be safely upgraded or replaced.
--ignore-daemonsetsPreserves cluster-wide system daemon pods--delete-emptydir-dataContinues even if pods have temporary emptyDir storageCordon Node (Mark Unschedulable)
Prevent the Kubernetes scheduler from assigning new pods to the target node.
Switch Active Kubeconfig Cluster Context
Switch your active kubectl context between dev, staging, and production clusters.
Pro-Tips for Daily CLI Operations
1. Fast Namespace Switching
Instead of continuously passing -n <namespace> to every single kubectl command, set your context namespace permanently for the current shell session:
Or install kubens / kubectx from ahmetb/kubectx for instant switching:
2. Streamlining Command Aliases
Boost your terminal productivity by configuring recommended aliases in your ~/.bashrc or ~/.zshrc:
3. Safely Debugging Distroless & Scratch Containers
Production containers built without shells or diagnostic binaries can be inspected using Kubernetes Ephemeral Containers:
This injects common networking and debugging tools (curl, tcpdump, dig, iperf, strace, netstat) into the target pod's network and process namespaces without modifying the production image itself.
