I want to use kubectl get -o=custom-columns
to extract information with specific columns. The cropped yaml response is like this
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"creationTimestamp": "2018-11-27T14:37:46Z",
"generateName": "kubernetes-bootcamp-5c69669756-",
"labels": {
"pod-template-hash": "1725225312",
"run": "kubernetes-bootcamp"
},
"name": "kubernetes-bootcamp-5c69669756-cxhwf",
"namespace": "default",
"ownerReferences": [
{
"apiVersion": "extensions/v1beta1",
"blockOwnerDeletion": true,
"controller": true,
"kind": "ReplicaSet",
"name": "kubernetes-bootcamp-5c69669756",
"uid": "950aac8e-f24f-11e8-bf5d-065b6ba59aa8"
}
],
"resourceVersion": "118035",
"selfLink": "/api/v1/namespaces/default/pods/kubernetes-bootcamp-5c69669756-cxhwf",
"uid": "0190c234-f252-11e8-bf5d-065b6ba59aa8"
},
I want to extract the name from items[0].metadata.name, but I don't know the syntax.
My questions:
- What is the query syntax used in this situation. Is it JSON path? I don't see it documented.
- What is the specific query in my case?