Custom columns
To define custom columns and output only the details that you want into a table, you can use the
custom-columns
option. You can choose to define the custom columns inline or use a template file:-o custom-columns=<spec>
or-o custom-columns-file=<filename>
.通过
custom-columns
,可以输出你想要的资源的详细信息
示例
Inline:
kubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion
Template file:
kubectl get pods <pod-name> -o custom-columns-file=template.txt
where the template.txt
file contains:
NAME RSRC metadata.name metadata.resourceVersion
The result of running either command is:
NAME RSRC submit-queue 610995