Skip to content
Browse files

updating with command to get containerIDs of all initCo…

…ntainer (#19243)

* adding

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 <>
  • Loading branch information
anapsix committed Mar 16, 2020
1 parent 9e5b981 commit 1f958e0744a3b56f5c4daa6d29029dea8b3ca7a7
Showing with 4 additions and 0 deletions.
  1. +4 −0 content/en/docs/reference/kubectl/
@@ -191,6 +191,10 @@ JSONPATH='{range .items[*]}{}:{range @.status.conditions[*]}{@.ty
# List all Secrets currently in use by a pod
kubectl get pods -o json | jq '.items[].spec.containers[].env[]?' | 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

0 comments on commit 1f958e0

Please sign in to comment.
You can’t perform that action at this time.