Skip to main content

kubectl Command Reference

v1.0.1

Browse kubectl commands with flags, examples, and tips for Kubernetes cluster management.

Quick-reference for kubectl commands — get, describe, apply, delete, exec, logs, port-forward, rollout, scale, and config — with flags, output formats, and copy-ready command examples.

How to use
  • Search by command name (e.g. "rollout", "exec", "apply") to see its full syntax and common flags.
  • Click any command example to copy it — placeholders like <pod-name> are highlighted for replacement.
  • Browse the Output Formats section to find the right -o flag (json, yaml, wide, jsonpath, go-template).
  • Use the Config / Context section for commands that switch clusters and namespaces.
kubectl getBasics

List one or more resources.

Syntax

kubectl get <resource> [name] [flags]

Common Flags

-n, --namespaceSpecify namespace
-o, --outputOutput format: json|yaml|wide|name
-A, --all-namespacesList across all namespaces
-l, --selectorFilter by label selector
--watchWatch for changes

Example

kubectl get pods -n kube-system
kubectl get all -A
kubectl get pod my-pod -o yaml