Update cheatsheet.md

Adding comments to ensure default namespace, container and that the command is supported.
Add note to show you can substitute `env` for any supported command.
This commit is contained in:
Adam Robertson 2021-04-15 11:28:07 -07:00 committed by GitHub
parent 98a20fb123
commit 21bf5f96bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -217,8 +217,8 @@ kubectl get nodes -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
# Produce a period-delimited tree of all keys returned for pods, etc
kubectl get pods -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'
# Produce ENV for all pods
# Make sure to set your default namespace or this will run on system pods
# Produce ENV for all pods, assuming you have a default container for the pods, default namespace and the `env` command is supported.
# Helpful when running any supported command across all pods, not just `env`
for pod in $(kubectl get po --output=jsonpath={.items..metadata.name}); do echo $pod && kubectl exec -it $pod env; done
```