Skip to main content
grammar
Source Link
Kyslik
  • 284
  • 3
  • 9

Since the result is JSON, pipe the result to jq and go from there.

kubectl get | jq '.items[0].metadata.name'

yeldsyields

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"

Since the result is JSON, pipe the result to jq and go from there.

kubectl get | jq '.items[0].metadata.name'

yelds

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"

Since the result is JSON, pipe the result to jq and go from there.

kubectl get | jq '.items[0].metadata.name'

yields

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"
deleted 18 characters in body
Source Link
Kyslik
  • 284
  • 3
  • 9

Since the result is JSON, pipe the result to jq and go from there.

kubectl get -o=custom-columns | jq '.items[0].metadata.name'

yelds

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"

Since the result is JSON, pipe the result to jq and go from there.

kubectl get -o=custom-columns | jq '.items[0].metadata.name'

yelds

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"

Since the result is JSON, pipe the result to jq and go from there.

kubectl get | jq '.items[0].metadata.name'

yelds

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"
Source Link
Kyslik
  • 284
  • 3
  • 9

Since the result is JSON, pipe the result to jq and go from there.

kubectl get -o=custom-columns | jq '.items[0].metadata.name'

yelds

➜ cat abc.json | jq '.items[0].metadata.name'
"kubernetes-bootcamp-5c69669756-cxhwf"