Skip to content

Commit 544ca86

Browse files
authored
Merge pull request #39021 from Zhuzhenghao/list-all-running-container-images
[zh-cn]sync list-all-running-container-images.md
2 parents b448a42 + ecef38d commit 544ca86

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

content/zh-cn/docs/tasks/access-application-cluster/list-all-running-container-images.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ of Containers for each.
3232
在本练习中,你将使用 kubectl 来获取集群中运行的所有 Pod,并格式化输出来提取每个 Pod 中的容器列表。
3333

3434
<!--
35-
## List all Containers in all namespaces
35+
## List all Container images in all namespaces
3636
3737
- Fetch all Pods in all namespaces using `kubectl get pods --all-namespaces`
3838
- Format the output to include only the list of Container image names
3939
using `-o jsonpath={.items[*].spec.containers[*].image}`. This will recursively parse out the
4040
`image` field from the returned json.
41-
- See the [jsonpath reference](/docs/user-guide/jsonpath/)
41+
- See the [jsonpath reference](/docs/reference/kubectl/jsonpath/)
4242
for further information on how to use jsonpath.
4343
- Format the output using standard tools: `tr`, `sort`, `uniq`
4444
- Use `tr` to replace spaces with newlines
4545
- Use `sort` to sort the results
4646
- Use `uniq` to aggregate image counts
4747
-->
48-
## 列出所有命名空间下的所有容器
48+
## 列出所有命名空间下的所有容器镜像
4949

5050
- 使用 `kubectl get pods --all-namespaces` 获取所有命名空间下的所有 Pod
5151
- 使用 `-o jsonpath={.items[*].spec.containers[*].image}` 来格式化输出,以仅包含容器镜像名称。
@@ -80,7 +80,7 @@ jsonpath 解释如下:
8080
- `.image`: 获取镜像
8181

8282
<!--
83-
When fetching a single Pod by name, e.g. `kubectl get pod nginx`,
83+
When fetching a single Pod by name, for example `kubectl get pod nginx`,
8484
the `.items[*]` portion of the path should be omitted because a single
8585
Pod is returned instead of a list of items.
8686
-->
@@ -105,12 +105,12 @@ sort
105105
```
106106

107107
<!--
108-
## List Containers filtering by Pod label
108+
## List Container images filtering by Pod label
109109
110110
To target only Pods matching a specific label, use the -l flag. The
111111
following matches only Pods with labels matching `app=nginx`.
112112
-->
113-
## 列出以标签过滤后的 Pod 的所有容器
113+
## 列出以标签过滤后的 Pod 的所有容器镜像
114114

115115
要获取匹配特定标签的 Pod,请使用 -l 参数。以下匹配仅与标签 `app=nginx` 相符的 Pod。
116116

@@ -119,12 +119,12 @@ kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].ima
119119
```
120120

121121
<!--
122-
## List Containers filtering by Pod namespace
122+
## List Container images filtering by Pod namespace
123123
124124
To target only pods in a specific namespace, use the namespace flag. The
125125
following matches only Pods in the `kube-system` namespace.
126126
-->
127-
## 列出以命名空间过滤后的 Pod 的所有容器
127+
## 列出以命名空间过滤后的 Pod 的所有容器镜像
128128

129129
要获取匹配特定命名空间的 Pod,请使用 namespace 参数。以下仅匹配 `kube-system` 命名空间下的 Pod。
130130

@@ -133,12 +133,12 @@ kubectl get pods --namespace kube-system -o jsonpath="{.items[*].spec.containers
133133
```
134134

135135
<!--
136-
## List Containers using a go-template instead of jsonpath
136+
## List Container images using a go-template instead of jsonpath
137137
138138
As an alternative to jsonpath, Kubectl supports using [go-templates](https://golang.org/pkg/text/template/)
139139
for formatting the output:
140140
-->
141-
## 使用 go-template 代替 jsonpath 来获取容器
141+
## 使用 go-template 代替 jsonpath 来获取容器镜像
142142

143143
作为 jsonpath 的替代,Kubectl 支持使用 [go-templates](https://golang.org/pkg/text/template/) 来格式化输出:
144144

0 commit comments

Comments
 (0)