File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
content/zh/docs/reference/kubectl Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ kubectl get pods -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
357
357
358
358
# Produce ENV for all pods, assuming you have a default container for the pods, default namespace and the `env` command is supported.
359
359
# 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
361
361
```
362
362
-->
363
363
``` bash
@@ -436,7 +436,7 @@ kubectl get pods -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
436
436
437
437
# 假设你的 Pods 有默认的容器和默认的名字空间,并且支持 'env' 命令,可以使用以下脚本为所有 Pods 生成 ENV 变量。
438
438
# 该脚本也可用于在所有的 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
440
440
```
441
441
442
442
<!--
You can’t perform that action at this time.
0 commit comments