Command-line tool for controlling Kubernetes clusters.
medium risk
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.
| Flag | Meaning |
|---|---|
-n --namespace | Specify Kubernetes namespace |
--context | Use a specific kubeconfig context |
-o --output | Output format: wide, yaml, json, jsonpath |
--all-namespaces | Operate across all namespaces |
-l --selector | Filter by label selector |
--dry-run | Preview what would happen without applying |
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 →Set `kubectl config set-context --current --namespace=production` to avoid typing -n production on every command.
Reference text is hand-written and may be incomplete — check man kubectl for your version. Test destructive commands on a non-production system first.