I have a requirement to inspect a particular label of the nine nodes that comprise my Kubernetes ( actually Red Hat OpenShift Container Platform ) cluster.
The label in question is ibm-cloud.kubernetes.io/worker-id as the OCP cluster is hosted on IBM Cloud.
Here's up with what I ended: -
kubectl get nodes --output wide --label-columns ibm-cloud.kubernetes.io/worker-id | grep -v NAME | awk '{print $12}'
and here's the JSON / jq variant: -
kubectl get nodes --output JSON --label-columns ibm-cloud.kubernetes.io/worker-id | jq '.items[].metadata.labels.ibm-cloud.kubernetes.io/worker-id'
which borks with: -
jq: error: cloud/0 is not defined at <top-level>, line 1:
.items[].metadata.labels.ibm-cloud.kubernetes.io/worker-id
jq: error: worker/0 is not defined at <top-level>, line 1:
.items[].metadata.labels.ibm-cloud.kubernetes.io/worker-id
jq: error: id/0 is not defined at <top-level>, line 1:
.items[].metadata.labels.ibm-cloud.kubernetes.io/worker-id
jq: 3 compile errors
No comments:
Post a Comment