File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
content/en/docs/tasks/access-application-cluster Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ of Containers for each.
23
23
24
24
- Fetch all Pods in all namespaces using ` kubectl get pods --all-namespaces `
25
25
- Format the output to include only the list of Container image names
26
- using ` -o jsonpath={.items[*].spec. containers[*].image} ` . This will recursively parse out the
26
+ using ` -o jsonpath={.items[*].spec['initContainers', ' containers'] [*].image} ` . This will recursively parse out the
27
27
` image ` field from the returned json.
28
28
- See the [ jsonpath reference] ( /docs/reference/kubectl/jsonpath/ )
29
29
for further information on how to use jsonpath.
@@ -33,7 +33,7 @@ of Containers for each.
33
33
- Use ` uniq ` to aggregate image counts
34
34
35
35
``` shell
36
- kubectl get pods --all-namespaces -o jsonpath=" {.items[*].spec. containers[*].image}" | \
36
+ kubectl get pods --all-namespaces -o jsonpath=" {.items[*].spec['initContainers', ' containers'] [*].image}" | \
37
37
tr -s ' [[:space:]]' ' \n' | \
38
38
sort | \
39
39
uniq -c
@@ -42,7 +42,7 @@ The jsonpath is interpreted as follows:
42
42
43
43
- ` .items[*] ` : for each returned value
44
44
- ` .spec ` : get the spec
45
- - ` . containers[*]` : for each container
45
+ - ` ['initContainers', ' containers'] [*]` : for each container
46
46
- ` .image ` : get the image
47
47
48
48
{{< note >}}
You can’t perform that action at this time.
0 commit comments