常見的輸出格式有:
* custom-columns=<spec> # 根據自定義列名進行輸出,逗號分隔 * custom-columns-file=<filename> # 從文件中獲取自定義列名進行輸出 * json # 以JSON格式顯示結果 * jsonpath=<template> # 輸出jasonpath表達式定義的字段信息 * jasonpath-file=<filename> # 輸出jsonpath表達式定義的字段信息,來源於文件 * name # 僅輸出資源對象的名稱 * wide # 輸出更多信息,比如會輸出node名 * yaml # 以yaml格式輸出
實例:
[root@localhost ~]# kubectl get pods NAME READY STATUS RESTARTS AGE mysql-dr556 1/1 Running 1 11h myweb-j9760 1/1 Running 1 11h
[root@localhost ~]# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE mysql-dr556 1/1 Running 1 11h 172.17.0.2 127.0.0.1 myweb-j9760 1/1 Running 1 11h 172.17.0.3 127.0.0.1
[root@localhost ~]# kubectl get pods -o name pod/mysql-dr556 pod/myweb-j9760