updating cheatsheet.md with command to get containerIDs of all initContainer (#19243)

* adding cheatsheet.md

adding kubectl command to get containerIDs of all
initContainers for every Pod in the cluster
helps to identify stopped container which should not be removed,
when running manual cleanup of stopped containers on K8s cluster nodes

* adding more context for finding initContainer IDs

* removing reference to github issue

Signed-off-by: Anastas Dancha <anapsix@random.io>
pull/19655/head
Anastas Dancha 2020-03-16 09:12:35 +03:00 committed by GitHub
parent 9e5b981f80
commit 1f958e0744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -191,6 +191,10 @@ JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.ty
# List all Secrets currently in use by a pod
kubectl get pods -o json | jq '.items[].spec.containers[].env[]?.valueFrom.secretKeyRef.name' | grep -v null | sort | uniq
# List all containerIDs of initContainer of all pods
# Helpful when cleaning up stopped containers, while avoiding removal of initContainers.
kubectl get pods --all-namespaces -o jsonpath='{range .items[*].status.initContainerStatuses[*]}{.containerID}{"\n"}{end}' | cut -d/ -f3
# List Events sorted by timestamp
kubectl get events --sort-by=.metadata.creationTimestamp