JSONPath

A small query language for picking fields out of JSON, which kubectl uses to print exactly one value from an object.

In more detail

Expressions sit in braces and walk the object with dots, such as {.status.phase} or {.items[0].metadata.name}. Two dots, as in {..namespace}, search at any depth. It turns kubectl output into a single value a script can test.

Example

kubectl get pod web -o jsonpath='{.status.phase}'

Related terms

Taught in

References

Certification courses