From 4a1a2c9017d70574e64b4050093b927916c2d16c Mon Sep 17 00:00:00 2001 From: WanLinghao Date: Sun, 3 Feb 2019 10:56:47 +0800 Subject: [PATCH] Add a case to illustrate how to use `kubectl get -o custom-columns` --- pkg/kubectl/cmd/get/get.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/kubectl/cmd/get/get.go b/pkg/kubectl/cmd/get/get.go index bc15a3a4726..5b8c3cac5dc 100644 --- a/pkg/kubectl/cmd/get/get.go +++ b/pkg/kubectl/cmd/get/get.go @@ -118,6 +118,9 @@ var ( # Return only the phase value of the specified pod. kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}} + # List resource information in custom columns. + kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image + # List all replication controllers and services together in ps output format. kubectl get rc,services