Kubectl Output 101

Cheatsheet & examples of using kubectl get -o

Stefanie Lai
CodeX

--

From unsplash, @ollila

The kubectl command is a “medium” with which most developers communicate with Kubernetes. You may have never learned helm, not participating in Kubernetes Operator development, but you must have experience in using kubectl to interact with Kubernetes resources in CLI.

We have just set off on the journey of exploring kubectl’s magic power, and this stop is kubectl output.

Kubectl Output

Kubectl output is kubectl get output format, whose basic picture can be seen from the help info from kubectl.

When output flag kicks in

With a simple kubectl get pod -n kube-system, we can obtain the basic information about all kube-system namespace pods, such as name, status, age, etc. But for more detailed information like container, labels, volumes, we used to turn to kubectl describe, which forms several pages’ YAML content and is not so friendly for field filtering.

Yes, it’s time for -o/ — output flag of kubectl get to kick in to fully tap kubectl get’s potential and speed up your CLI.

My Cheatsheet

The help info and the relevant documentation can offer some help, but not enough, for example, the following chart…

--

--

Responses (1)