inspection
kubectl cluster-info
Prints the endpoints of the control-plane services for the current context. The dump subcommand collects a large diagnostic bundle of cluster state for offline analysis.
kubectl cluster-info [dump] [flags] Common flags
| Flag | Purpose |
|---|---|
| --output-directory | With dump, write files to a directory instead of stdout. |
| --all-namespaces | With dump, include every namespace (default false). |
| --namespaces | With dump, comma-separated namespaces to include. |
| --context | Use a specific context without switching the default. |
Examples
kubectl cluster-info Show API server and core-services URLs.
kubectl cluster-info dump --output-directory=./dump --all-namespaces Snapshot the entire cluster for support triage.
kubectl cluster-info --context=staging Query the staging cluster without switching context.
Gotcha
cluster-info dump can produce hundreds of megabytes and may include secrets in plain text - handle the output carefully.
Related commands
kubectl config
Reads and modifies kubeconfig files that define clusters, users, and contexts. It is how you switch between clusters, change the active namespace, and register new credentials.
kubectl get
Lists one or more resources of a given type from the cluster. It is the primary read command for pods, services, deployments, and any other Kubernetes object, with flexible output formats for scripting and inspection.
kubectl top
Displays CPU and memory usage for nodes or pods, powered by the metrics.k8s.io API. Requires the metrics-server (or an equivalent aggregator) to be installed in the cluster.
kubectl describe
Shows a human-readable, aggregated view of a resource including its spec, status, related events, and controllers. It is the go-to command for debugging why a pod is Pending, CrashLoopBackOff, or otherwise misbehaving.
kubectl explain
Prints documentation for a resource kind and its fields, sourced from the live cluster's OpenAPI schema. It is the offline-safe reference for authoring manifests against the exact API version your cluster serves.