Skip to content

Commit 2b46eef

Browse files
authored
Merge pull request #30568 from Arhell/upd
[zh] update pod mapping to avoid deprecation notice
2 parents be1deab + 2b40286 commit 2b46eef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/zh/docs/reference/kubectl/cheatsheet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ kubectl get pods -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
357357
358358
# Produce ENV for all pods, assuming you have a default container for the pods, default namespace and the `env` command is supported.
359359
# Helpful when running any supported command across all pods, not just `env`
360-
for pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod env; done
360+
for pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod -- env; done
361361
```
362362
-->
363363
```bash
@@ -436,7 +436,7 @@ kubectl get pods -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
436436

437437
# 假设你的 Pods 有默认的容器和默认的名字空间,并且支持 'env' 命令,可以使用以下脚本为所有 Pods 生成 ENV 变量。
438438
# 该脚本也可用于在所有的 Pods 里运行任何受支持的命令,而不仅仅是 'env'。
439-
for pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod env; done
439+
for pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod -- env; done
440440
```
441441

442442
<!--

0 commit comments

Comments
 (0)