rva chaitanya:
I think I need to restate my question, lets assume I am grepping for osImage, with output looking like this how would I construct the list like status.nodeInfo.osImage?
k get nodes -o=jsonpath='{.items[0]}' | grep -i osImage
{“apiVersion”:“v1”,“kind”:“Node”,“metadata”:{“annotations”:{“http://kubeadm.alpha.kubernetes.io/cri-socket|kubeadm.alpha.kubernetes.io/cri-socket”:“/var/run/dockershim.sock”,“http://node.alpha.kubernetes.io/ttl|node.alpha.kubernetes.io/ttl”:“0”,“http://volumes.kubernetes.io/controller-managed-attach-detach|volumes.kubernetes.io/controller-managed-attach-detach”:“true”},“creationTimestamp”:“2023-03-07T16:05:48Z”,“labels”:{“http://beta.kubernetes.io/arch|beta.kubernetes.io/arch”:“amd64”,“http://beta.kubernetes.io/os|beta.kubernetes.io/os”:“linux”,“http://kubernetes.io/arch|kubernetes.io/arch”:“amd64”,“http://kubernetes.io/hostname|kubernetes.io/hostname”:“controlplane”,“http://kubernetes.io/os|kubernetes.io/os”:“linux”,“http://node-role.kubernetes.io/control-plane|node-role.kubernetes.io/control-plane”:“”,“http://node-role.kubernetes.io/master|node-role.kubernetes.io/master”:“”,“http://node.kubernetes.io/exclude-from-external-load-balancers|node.kubernetes.io/exclude-from-external-load-balancers”:“”},“managedFields”:[{“apiVersion”:“v1”,“fieldsType”:“FieldsV1”,“fieldsV1”:{“f:metadata”:{“f:annotations”:{“.”:{},“f:http://kubeadm.alpha.kubernetes.io/cri-socket":{},“f:volumes.kubernetes.io/controller-managed-attach-detach”:{}|kubeadm.alpha.kubernetes.io/cri-socket":{},“f:volumes.kubernetes.io/controller-managed-attach-detach”:{}},“f:labels”:{”.“:{},“f:http://beta.kubernetes.io/arch":{},“f:beta.kubernetes.io/os”:{},“f:kubernetes.io/arch”:{},“f:kubernetes.io/hostname”:{},“f:kubernetes.io/os”:{},“f:node-role.kubernetes.io/control-plane”:{},“f:node-role.kubernetes.io/master”:{},“f:node.kubernetes.io/exclude-from-external-load-balancers”:{}|beta.kubernetes.io/arch":{},“f:beta.kubernetes.io/os”:{},“f:kubernetes.io/arch”:{},“f:kubernetes.io/hostname”:{},“f:kubernetes.io/os”:{},“f:node-role.kubernetes.io/control-plane”:{},“f:node-role.kubernetes.io/master”:{},“f:node.kubernetes.io/exclude-from-external-load-balancers”:{}}}},“manager”:“Go-http-client”,“operation”:“Update”,“time”:“2023-03-07T16:05:52Z”},{“apiVersion”:“v1”,“fieldsType”:“FieldsV1”,“fieldsV1”:{“f:status”:{“f:conditions”:{“k:{"type":"NetworkUnavailable"}”:{”.”:{},“f:lastHeartbeatTime”:{},“f:lastTransitionTime”:{},“f:message”:{},“f:reason”:{},“f:status”:{},“f:type”:{}}}}},“manager”:“kube-utils”,“operation”:“Update”,“subresource”:“status”,“time”:“2023-03-07T16:06:26Z”},{“apiVersion”:“v1”,“fieldsType”:“FieldsV1”,“fieldsV1”:{“f:status”:{“f:allocatable”:{“f:ephemeral-storage”:{}},“f:conditions”:{“k:{"type":"DiskPressure"}”:{“f:lastHeartbeatTime”:{}},“k:{"type":"MemoryPressure"}”:{“f:lastHeartbeatTime”:{}},“k:{"type":"PIDPressure"}”:{“f:lastHeartbeatTime”:{}},“k:{"type":"Ready"}”:{“f:lastHeartbeatTime”:{},“f:lastTransitionTime”:{},“f:message”:{},“f:reason”:{},“f:status”:{}}},“f:images”:{}}},“manager”:“Go-http-client”,“operation”:“Update”,“subresource”:“status”,“time”:“2023-03-07T16:06:27Z”},{“apiVersion”:“v1”,“fieldsType”:“FieldsV1”,“fieldsV1”:{“f:metadata”:{“f:annotations”:{“f:http://node.alpha.kubernetes.io/ttl":{}|node.alpha.kubernetes.io/ttl":{}}},“f:spec”:{“f:podCIDR”:{},“f:podCIDRs”:{”.":{},“v:"10.244.0.0/24"”:{}},“f:taints”:{}}},“manager”:“kube-controller-manager”,“operation”:“Update”,“time”:“2023-03-07T16:06:27Z”}],“name”:“controlplane”,“resourceVersion”:“3820”,“uid”:“cb76c727-27fa-4939-9bc1-638506cf84fb”},“spec”:{“podCIDR”:“10.244.0.0/24”,“podCIDRs”:[“10.244.0.0/24”],“taints”:[{“effect”:“NoSchedule”,“key”:“http://node-role.kubernetes.io/master|node-role.kubernetes.io/master”}]},“status”:{“addresses”:[{“address”:“192.29.1.9”,“type”:“InternalIP”},{“address”:“controlplane”,“type”:“Hostname”}],“allocatable”:{“cpu”:“36”,“ephemeral-storage”:“936398358207”,“hugepages-1Gi”:“0”,“hugepages-2Mi”:“0”,“memory”:“214484660Ki”,“pods”:“110”},“capacity”:{“cpu”:“36”,“ephemeral-storage”:“1016057248Ki”,“hugepages-1Gi”:“0”,“hugepages-2Mi”:“0”,“memory”:“214587060Ki”,“pods”:“110”},“conditions”:[{“lastHeartbeatTime”:“2023-03-07T16:06:26Z”,“lastTransitionTime”:“2023-03-07T16:06:26Z”,“message”:“Weave pod has set this”,“reason”:“WeaveIsUp”,“status”:“False”,“type”:“NetworkUnavailable”},{“lastHeartbeatTime”:“2023-03-07T16:47:20Z”,“lastTransitionTime”:“2023-03-07T16:05:44Z”,“message”:“kubelet has sufficient memory available”,“reason”:“KubeletHasSufficientMemory”,“status”:“False”,“type”:“MemoryPressure”},{“lastHeartbeatTime”:“2023-03-07T16:47:20Z”,“lastTransitionTime”:“2023-03-07T16:05:44Z”,“message”:“kubelet has no disk pressure”,“reason”:“KubeletHasNoDiskPressure”,“status”:“False”,“type”:“DiskPressure”},{“lastHeartbeatTime”:“2023-03-07T16:47:20Z”,“lastTransitionTime”:“2023-03-07T16:05:44Z”,“message”:“kubelet has sufficient PID available”,“reason”:“KubeletHasSufficientPID”,“status”:“False”,“type”:“PIDPressure”},{“lastHeartbeatTime”:“2023-03-07T16:47:20Z”,“lastTransitionTime”:“2023-03-07T16:06:27Z”,“message”:“kubelet is posting ready status”,“reason”:“KubeletReady”,“status”:“True”,“type”:“Ready”}],“daemonEndpoints”:{“kubeletEndpoint”:{“Port”:10250}},“images”:[{“names”:[“kodekloud/fluent-ui-running@sha256:78fd68ba8a79adcd3e58897a933492886200be513076ba37f843008cc0168f81”,“kodekloud/fluent-ui-running:latest”],“sizeBytes”:968662796},{“names”:[“http://k8s.gcr.io/etcd@sha256:64b9ea357325d5db9f8a723dcf503b5a449177b17ac87d69481e126bb724c263|k8s.gcr.io/etcd@sha256:64b9ea357325d5db9f8a723dcf503b5a449177b17ac87d69481e126bb724c263”,“http://k8s.gcr.io/etcd:3.5.1-0|k8s.gcr.io/etcd:3.5.1-0”],“sizeBytes”:292558922},{“names”:[“nginx@sha256:0047b729188a15da49380d9506d65959cce6d40291ccfb4e039f5dc7efd33286”,“nginx:latest”],“sizeBytes”:141812353},{“names”:[“http://k8s.gcr.io/kube-apiserver@sha256:d10db42c2353539ce15006854edfb6707ba6025f282d59d962729ed3b6039004|k8s.gcr.io/kube-apiserver@sha256:d10db42c2353539ce15006854edfb6707ba6025f282d59d962729ed3b6039004”,“http://k8s.gcr.io/kube-apiserver:v1.23.0|k8s.gcr.io/kube-apiserver:v1.23.0”],“sizeBytes”:135154064},{“names”:[“http://k8s.gcr.io/kube-controller-manager@sha256:0bfbb13e5e9cec329523b6f654687af8ce058adbc90b42e5af7a929ac22e2a53|k8s.gcr.io/kube-controller-manager@sha256:0bfbb13e5e9cec329523b6f654687af8ce058adbc90b42e5af7a929ac22e2a53”,“http://k8s.gcr.io/kube-controller-manager:v1.23.0|k8s.gcr.io/kube-controller-manager:v1.23.0”],“sizeBytes”:124963795},{“names”:[“http://k8s.gcr.io/kube-proxy@sha256:2e8292d30042bb75f745d2a90d0fc4fbc3a3b1bdbe5b9d3bf50dd866c62b2ba7|k8s.gcr.io/kube-proxy@sha256:2e8292d30042bb75f745d2a90d0fc4fbc3a3b1bdbe5b9d3bf50dd866c62b2ba7”,“http://k8s.gcr.io/kube-proxy:v1.23.0|k8s.gcr.io/kube-proxy:v1.23.0”],“sizeBytes”:112319647},{“names”:[“weaveworks/weave-kube@sha256:d797338e7beb17222e10757b71400d8471bdbd9be13b5da38ce2ebf597fb4e63”,“weaveworks/weave-kube:2.8.1”],“sizeBytes”:89037656},{“names”:[“http://quay.io/coreos/flannel@sha256:51223d328b2f85d8fe9ad35db82d564b45b03fd1002728efcf14011aff02de78|quay.io/coreos/flannel@sha256:51223d328b2f85d8fe9ad35db82d564b45b03fd1002728efcf14011aff02de78”,“http://quay.io/coreos/flannel:v0.13.1-rc1|quay.io/coreos/flannel:v0.13.1-rc1”],“sizeBytes”:64571708},{“names”:[“http://k8s.gcr.io/kube-scheduler@sha256:af8166ce28baa7cb902a2c0d16da865d5d7c892fe1b41187fd4be78ec6291c23|k8s.gcr.io/kube-scheduler@sha256:af8166ce28baa7cb902a2c0d16da865d5d7c892fe1b41187fd4be78ec6291c23”,“http://k8s.gcr.io/kube-scheduler:v1.23.0|k8s.gcr.io/kube-scheduler:v1.23.0”],“sizeBytes”:53476049},{“names”:[“http://quay.io/coreos/flannel@sha256:6d451d92c921f14bfb38196aacb6e506d4593c5b3c9d40a8b8a2506010dc3e10|quay.io/coreos/flannel@sha256:6d451d92c921f14bfb38196aacb6e506d4593c5b3c9d40a8b8a2506010dc3e10”,“http://quay.io/coreos/flannel:v0.12.0-amd64|quay.io/coreos/flannel:v0.12.0-amd64”],“sizeBytes”:52767393},{“names”:[“http://k8s.gcr.io/coredns/coredns@sha256:5b6ec0d6de9baaf3e92d0f66cd96a25b9edbce8716f5f15dcd1a616b3abd590e|k8s.gcr.io/coredns/coredns@sha256:5b6ec0d6de9baaf3e92d0f66cd96a25b9edbce8716f5f15dcd1a616b3abd590e”,“http://k8s.gcr.io/coredns/coredns:v1.8.6|k8s.gcr.io/coredns/coredns:v1.8.6”],“sizeBytes”:46829283},{“names”:[“nginx@sha256:dd8a054d7ef030e94a6449783605d6c306c1f69c10c2fa06b66a030e0d1db793”,“nginx:alpine”],“sizeBytes”:40709761},{“names”:[“weaveworks/weave-npc@sha256:38d3e30a97a2260558f8deb0fc4c079442f7347f27c86660dbfc8ca91674f14c”,“weaveworks/weave-npc:2.8.1”],“sizeBytes”:39273789},{“names”:[“busybox@sha256:7b3ccabffc97de872a30dfd234fd972a66d247c8cfc69b0550f276481852627c”,“busybox:latest”],“sizeBytes”:4867234},{“names”:[“http://k8s.gcr.io/pause@sha256:3d380ca8864549e74af4b29c10f9cb0956236dfb01c40ca076fb6c37253234db|k8s.gcr.io/pause@sha256:3d380ca8864549e74af4b29c10f9cb0956236dfb01c40ca076fb6c37253234db”,“http://k8s.gcr.io/pause:3.6|k8s.gcr.io/pause:3.6”],“sizeBytes”:682696}],“nodeInfo”:{“architecture”:“amd64”,“bootID”:“be964ace-7e5d-4381-9730-473c3beff9fa”,“containerRuntimeVersion”:“docker://19.3.0”,“kernelVersion”:“5.4.0-1100-gcp”,“kubeProxyVersion”:“v1.23.0”,“kubeletVersion”:“v1.23.0”,“machineID”:“316b0b020b9749fc95be9fb34bc2b69d”,“operatingSystem”:“linux”,“osImage”:“Ubuntu 18.04.6 LTS”,“systemUUID”:“b657022f-2503-a146-eb03-ce67385686da”}}}