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
parent
9e5b981f80
commit
1f958e0744
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue