CKA 14 : JSON
k command -o json
k command -o=jsonpath='{QUERY1}{QUERY2}'
{'\n'} and {'\t}
Loop : '{range.items[*]}{QUERY}{end}'
k command -o=custom-columns=COL_NAME1:QUERY1, COL_NAME2:QUERY2
Here, QUERYi is without .items[*]. It can be also without '{}'
k command --sort-by=QUERY1
Here, QUERY1 is without .items[*]. It can be also without '{}'
kubectl get pv --sort-by=.spec.capacity.storage -o=custom-columns=CAPACITY:.spec.capacity.storage
k get pv --sort-by={".spec.capacity.storage"} -o=custom_columns=CAPACITY:.spec.capacity.storage
k get pv --sort-by=.spec.capacity.storage -o=custom-columns=CAPACITY:.spec.capacity.storage
k get pv --sort-by=.spec.capacity.storage -o=custom_columns=CAPACITY:.spec.capacity.storage
kubectl config view --kubeconfig=my-kube-config
k command -o=jsonpath='{QUERY1}{QUERY2}'
{'\n'} and {'\t}
Loop : '{range.items[*]}{QUERY}{end}'
k command -o=custom-columns=COL_NAME1:QUERY1, COL_NAME2:QUERY2
Here, QUERYi is without .items[*]. It can be also without '{}'
k command --sort-by=QUERY1
Here, QUERY1 is without .items[*]. It can be also without '{}'
kubectl get pv --sort-by=.spec.capacity.storage -o=custom-columns=CAPACITY:.spec.capacity.storage
k get pv --sort-by={".spec.capacity.storage"} -o=custom_columns=CAPACITY:.spec.capacity.storage
k get pv --sort-by=.spec.capacity.storage -o=custom-columns=CAPACITY:.spec.capacity.storage
k get pv --sort-by=.spec.capacity.storage -o=custom_columns=CAPACITY:.spec.capacity.storage
kubectl config view --kubeconfig=my-kube-config
JSON query to list : pod v/s container image
k get po -A -o=custom-columns=Image:"spec.containers[*].image",Name:"metadata.name"
0 comments:
Post a Comment