kubectl Builder
Build kubectl commands interactively. Pick an action, choose options, copy the command. No cluster connection needed — everything runs in your browser.
Action
Common Recipes
Ready-to-use kubectl commands. Click a card to load it into the builder, or copy directly. Click a recipe to populate the builder, or copy the command directly.
Force delete stuck pod
Immediately remove a pod stuck in Terminating state
kubectl delete pod <pod-name> -n <namespace> --grace-period=0 --force
Click to load in builder
Restart a deployment
Rolling restart all pods in a deployment
kubectl rollout restart deployment/<name> -n <namespace>
Click to load in builder
Watch deployment rollout
Monitor rollout progress until complete
kubectl rollout status deployment/<name> -n <namespace>
Click to load in builder
Get all failing pods
List pods that are not in Running state
kubectl get pods -A --field-selector=status.phase!=Running
Click to load in builder
Decode a Kubernetes secret
Extract and decode a specific key from a secret
kubectl get secret <secret-name> -n <namespace> -o jsonpath='{.data.<key>}' | base64 --decodeClick to load in builder
Get events sorted by time
See recent cluster events (warnings first)
kubectl get events -A --sort-by='.metadata.creationTimestamp' --field-selector type=Warning
Click to load in builder
Resource usage by namespace
Show CPU and memory consumption for all pods
kubectl top pods -A --sort-by=memory --containers
Click to load in builder
Exec into a pod
Open an interactive shell in a running container
kubectl exec -it <pod-name> -n <namespace> -- /bin/sh
Click to load in builder
Drain node for maintenance
Safely evict all pods from a node before maintenance
kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
Click to load in builder
Create a secret from literal values
Quick way to create an Opaque secret with key-value pairs
kubectl create secret generic <name> -n <namespace> --from-literal=username=admin --from-literal=password=s3cret --dry-run=client -o yaml
Click to load in builder
Get pod IPs and nodes
Custom columns showing pod placement across the cluster
kubectl get pods -A -o custom-columns=NAMESPACE:.metadata.namespace,POD:.metadata.name,IP:.status.podIP,NODE:.spec.nodeName
Click to load in builder
Follow logs from multiple pods
Stream logs from all pods matching a label selector
kubectl logs -l app=<app-name> -n <namespace> -f --max-log-requests=10 --prefix
Click to load in builder
Scale deployment to zero
Temporarily stop all pods in a deployment
kubectl scale deployment/<name> -n <namespace> --replicas=0
Click to load in builder
Rollback to previous revision
Undo the last deployment rollout
kubectl rollout undo deployment/<name> -n <namespace>
Click to load in builder
What is kubectl?
kubectl is the command-line tool for interacting with Kubernetes clusters. It communicates with the Kubernetes API server to deploy applications, inspect resources, manage cluster operations, and view logs. If you work with Kubernetes, kubectl is your daily driver.
Why Use a kubectl Command Builder?
kubectl has hundreds of flags and options across dozens of commands. Even experienced engineers regularly look up the exact syntax for less common operations. This builder helps you construct the right command interactively — pick an action, select options, and copy the result. No more searching through cheat sheets.
kubectl Command Structure
Every kubectl command follows this pattern:
kubectl <action> <resource-type> [<name>] [flags] # Examples: kubectl get pods -n production -o wide kubectl describe deployment nginx -n default kubectl logs my-pod -f --tail=100 kubectl exec -it my-pod -n staging -- /bin/sh kubectl rollout restart deployment/api -n production
Most Used kubectl Commands
| Command | Purpose | Example |
|---|---|---|
| get | List resources | kubectl get pods -A -o wide |
| describe | Show details | kubectl describe pod my-pod |
| logs | View logs | kubectl logs my-pod -f --tail=100 |
| exec | Run command in pod | kubectl exec -it my-pod -- /bin/sh |
| apply | Apply config | kubectl apply -f deploy.yaml |
| delete | Delete resources | kubectl delete pod stuck-pod --force |
| rollout | Manage rollouts | kubectl rollout restart deploy/api |
| scale | Scale replicas | kubectl scale deploy/api --replicas=5 |
| port-forward | Forward ports | kubectl port-forward svc/db 5432:5432 |
| top | Resource usage | kubectl top pods --sort-by=memory |
Kubernetes Resource Types
Kubernetes has many resource types. The most common ones for daily operations:
- Pods — The smallest deployable unit. A pod runs one or more containers.
- Deployments — Manages ReplicaSets and provides declarative updates for pods.
- Services — Exposes pods as a network service (ClusterIP, NodePort, LoadBalancer).
- ConfigMaps & Secrets — Store configuration and sensitive data separately from pod specs.
- Ingresses — HTTP/HTTPS routing rules to services.
- StatefulSets — For stateful applications (databases, queues) with stable network identities.
- DaemonSets — Runs a pod on every node (monitoring agents, log collectors).
- Jobs & CronJobs — Run-to-completion and scheduled workloads.
Troubleshooting Workflow
When something goes wrong in Kubernetes, follow this sequence:
kubectl get pods -n <ns> -o wide— See pod status and node placementkubectl describe pod <name>— Check events, conditions, and container statuskubectl logs <name> --previous— View logs from the crashed containerkubectl exec -it <name> -- /bin/sh— Get a shell inside the containerkubectl get events --sort-by=.metadata.creationTimestamp— Check cluster-wide events
Use the builder above to construct each of these commands with the right flags for your specific scenario.
Output Formats
The -o flag controls output format. The most useful formats:
-o wide— Extra columns (node name, IP, etc.)-o yaml/-o json— Full resource definition-o jsonpath='...'— Extract specific fields using JSONPath-o name— Just the resource names (great for scripting)