kubectl

Command-line tool for controlling Kubernetes clusters.

medium risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

kubectl communicates with the Kubernetes API server to manage cluster resources. Always verify your current context with `kubectl config current-context` before running destructive commands in production.

Common flags
FlagMeaning
-n --namespaceSpecify Kubernetes namespace
--contextUse a specific kubeconfig context
-o --outputOutput format: wide, yaml, json, jsonpath
--all-namespacesOperate across all namespaces
-l --selectorFilter by label selector
--dry-runPreview what would happen without applying
Examples
kubectl get pods -n production -o wideList all production pods with node and IP info · explain & risk-check →
kubectl logs -f deployment/api-server -n production --tail=100Follow API server deployment logs · explain & risk-check →
kubectl rollout restart deployment/frontend -n productionPerform a rolling restart of the frontend deployment · explain & risk-check →
Pro tip

Set `kubectl config set-context --current --namespace=production` to avoid typing -n production on every command.

Related
helm k9s kubectx kubeadm stern
Open the full explainer →More in Kubernetes & Helm

Reference text is hand-written and may be incomplete — check man kubectl for your version. Test destructive commands on a non-production system first.