Skip to content
LatchkeyLatchkey home

kubectl cluster-info: Usage, Options & CI Errors

Confirm kubectl can reach the cluster - and where its endpoints are.

kubectl cluster-info prints the control-plane and core service URLs and, in doing so, verifies basic connectivity. It is the lightweight preflight to run at the top of a deploy job.

What it does

kubectl cluster-info reports the API server and add-on (DNS, etc.) endpoints. Because it makes a real API call, a clean exit proves your kubeconfig and credentials reach the cluster. cluster-info dump emits a large diagnostic bundle (nodes, pods, logs) for offline debugging.

Common usage

Terminal
kubectl cluster-info                                  # preflight check
kubectl cluster-info dump --output-directory=./k8s-dump
kubectl cluster-info dump -A > cluster-dump.txt

Common errors in CI

A failing cluster-info at the start of a job is a gift - it surfaces a broken kubeconfig before you waste minutes. "To further debug and diagnose cluster problems, use kubectl cluster-info dump" followed by "connection refused" / "i/o timeout" means the API server is unreachable: wrong endpoint, missing VPN/network path, or an expired token. cluster-info dump is heavy. Never run it on every job, only as an on-failure artifact, or it bloats logs and slows the pipeline.

Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes

Frequently asked questions

kubectl cluster-info: Usage, Options & CI Errors?
kubectl cluster-info prints the control-plane and core service URLs and, in doing so, verifies basic connectivity. It is the lightweight preflight to run at the top of a deploy job.
What it does?
kubectl cluster-info reports the API server and add-on (DNS, etc.) endpoints. Because it makes a real API call, a clean exit proves your kubeconfig and credentials reach the cluster. cluster-info dump emits a large diagnostic bundle (nodes, pods, logs) for offline debugging.
Common errors in CI?
A failing cluster-info at the start of a job is a gift - it surfaces a broken kubeconfig before you waste minutes. "To further debug and diagnose cluster problems, use kubectl cluster-info dump" followed by "connection refused" / "i/o timeout" means the API server is unreachable: wrong endpoint, missing VPN/network path, or an expired

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card