LinuxCommandLibrary

kubectl-cluster-info

Display Kubernetes cluster information

TLDR

Show basic cluster information

$ kubectl cluster-info
copy

Dump current cluster state to stdout (for debugging)
$ kubectl cluster-info dump
copy

Dump cluster state to a directory
$ kubectl cluster-info dump --output-directory [path/to/directory]
copy

Use a specific kubeconfig context
$ kubectl cluster-info --context [context_name]
copy

SYNOPSIS

kubectl cluster-info [-o, --output=format] [--context=name]

PARAMETERS

--context string
    Name of the kubeconfig context to use

-o, --output string
    Output format: name|json|yaml|go-template|... (default "name")

-h, --help
    Help for cluster-info

DESCRIPTION

The kubectl cluster-info command provides a quick overview of the Kubernetes cluster's control plane status and core service endpoints. It shows the addresses of the master (control plane) nodes, typically the API server URL, and lists available services like CoreDNS, scheduler, controller-manager, and the Kubernetes dashboard if deployed.

This is invaluable for verifying cluster accessibility post-setup or during troubleshooting. For instance, it confirms if the control plane is reachable and provides direct URLs for web interfaces without needing kubectl proxy or port-forwarding.

Output is human-readable by default (name format), but supports JSON, YAML, or templates for automation. It uses the current kubeconfig context unless specified otherwise. If the cluster is unreachable or no services are exposed, it reports errors clearly.

Common use cases include initial cluster validation, scripting cluster health checks, or obtaining dashboard URLs. Note it only shows cluster-wide services, not namespace-specific ones.

CAVEATS

Requires valid kubeconfig and cluster access; fails silently on unreachable clusters or missing services. Global flags like --kubeconfig and --request-timeout also apply.

EXAMPLES

kubectl cluster-info
kubectl cluster-info --context my-cluster --output json

OUTPUT SAMPLE

Kubernetes control plane is running at https://127.0.0.1:6443
CoreDNS is running at https://10.96.0.10:9153

HISTORY

Core kubectl subcommand since Kubernetes v1.0 (2014); enhanced with output formats in v1.4+. Remains unchanged in recent versions for backward compatibility.

SEE ALSO

kubectl version(1), kubectl get nodes(1), kubectl cluster-info dump(1)

Copied to clipboard