JSON Output Reference
Four kinder commands support --output json for scripting and automation: get clusters, get nodes, env, and doctor. JSON output goes to stdout; informational messages (such as progress output from doctor) go to stderr so they do not interfere with piped JSON.
Commands
Section titled “Commands”kinder get clusters
Section titled “kinder get clusters”kinder get clusters --output jsonReturns a JSON array of strings — one entry per cluster name. An empty result returns [].
["kind","my-cluster"]# Get the first cluster namekinder get clusters --output json | jq '.[0]'
# Count how many clusters existkinder get clusters --output json | jq 'length'
# Check if a specific cluster existskinder get clusters --output json | jq 'any(. == "kind")'kinder get nodes
Section titled “kinder get nodes”kinder get nodes --output jsonReturns a JSON array of objects. Each object has a name field (string) and a role field (string: "control-plane" or "worker"). An empty result returns []. The --all-clusters / -A flag is compatible with --output json.
[{"name":"kind-control-plane","role":"control-plane"},{"name":"kind-worker","role":"worker"}]# List only control-plane node nameskinder get nodes --output json | jq '[.[] | select(.role == "control-plane") | .name]'
# Count worker nodeskinder get nodes --output json | jq '[.[] | select(.role == "worker")] | length'
# List nodes across all clusterskinder get nodes --all-clusters --output json | jq '.[].name'kinder env
Section titled “kinder env”kinder env --output jsonReturns a single JSON object (not an array) with fields: kinderProvider (string), clusterName (string), and kubeconfig (string path).
{"kinderProvider":"docker","clusterName":"kind","kubeconfig":"/Users/user/.kube/config"}Use --name to target a cluster created with a non-default name:
kinder env --name my-cluster --output json# Extract the container runtime providerkinder env --output json | jq -r '.kinderProvider'
# Set KUBECONFIG from JSON outputexport KUBECONFIG=$(kinder env --output json | jq -r '.kubeconfig')kinder doctor
Section titled “kinder doctor”kinder doctor --output jsonReturns a JSON array of check result objects. Each object has a name field (string) and a status field ("ok", "warn", or "fail"). A message field is included when status is "warn" or "fail" and omitted when status is "ok".
All checks passing:
[{"name":"docker","status":"ok"},{"name":"kubectl","status":"ok"}]With a failure:
[{"name":"container-runtime","status":"fail","message":"no container runtime found..."},{"name":"kubectl","status":"ok"}]# Check if any checks failedkinder doctor --output json | jq 'any(.[]; .status == "fail")'
# Get only failed checks with their messageskinder doctor --output json | jq '[.[] | select(.status == "fail") | {name, message}]'
# Exit non-zero if any check is not ok (useful in CI)kinder doctor --output json | jq -e 'all(.[]; .status == "ok")' > /dev/nullCommon jq patterns
Section titled “Common jq patterns”These patterns work across multiple kinder commands:
# Pretty-print JSON outputkinder doctor --output json | jq '.'
# Extract all node names as plain text (one per line)kinder get nodes --output json | jq -r '.[].name'
# CI guard: fail the pipeline if any doctor check is not okkinder doctor --output json | jq -e 'all(.[]; .status == "ok")' > /dev/nullCommands without JSON support
Section titled “Commands without JSON support”The following commands do not support --output json:
kinder get kubeconfigkinder create clusterkinder delete cluster
Passing --output json to these commands will return an error.