Output Formatting

The default output format for all kubectl commands is the human-readable plain-text format.

The -o flag allows us to output the details in several different formats.

Kubectl

kubectl [command] [TYPE] [NAME] -o

Here are some of the commonly used formats:

  • -o json Output a JSON formatted API object.

  • -o name Print only the resource name and nothing else.

  • -o wide Output in the plain-text format with any additional information.

  • -o yaml Output a YAML formatted API object.