Skip to main content

rawops.dev

Skip to tool content

kubectl Builder

Build kubectl commands interactively. Pick an action, choose options, copy the command. No cluster connection needed — everything runs in your browser.

command preview
Select an action below to start building your command|

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.

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

Click to load in builder

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

CommandPurposeExample
getList resourceskubectl get pods -A -o wide
describeShow detailskubectl describe pod my-pod
logsView logskubectl logs my-pod -f --tail=100
execRun command in podkubectl exec -it my-pod -- /bin/sh
applyApply configkubectl apply -f deploy.yaml
deleteDelete resourceskubectl delete pod stuck-pod --force
rolloutManage rolloutskubectl rollout restart deploy/api
scaleScale replicaskubectl scale deploy/api --replicas=5
port-forwardForward portskubectl port-forward svc/db 5432:5432
topResource usagekubectl top pods --sort-by=memory

Kubernetes Resource Types

Kubernetes has many resource types. The most common ones for daily operations:

Troubleshooting Workflow

When something goes wrong in Kubernetes, follow this sequence:

  1. kubectl get pods -n <ns> -o wide — See pod status and node placement
  2. kubectl describe pod <name> — Check events, conditions, and container status
  3. kubectl logs <name> --previous — View logs from the crashed container
  4. kubectl exec -it <name> -- /bin/sh — Get a shell inside the container
  5. kubectl 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:

Related Tools & Resources