Difference between revisions of "List containers on a POD"

From wikieduonline
Jump to navigation Jump to search
(Created page with " kubectl get pods YourPOD -o jsonpath='{.spec.containers[*].name}'")
 
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
  [[kubectl get pods]] YourPOD -o [[jsonpath]]='{[[.spec.containers]][*].name}'
 
  [[kubectl get pods]] YourPOD -o [[jsonpath]]='{[[.spec.containers]][*].name}'
 +
 +
 +
cat /yourfile.txt | while read line; do for i in "$line"; do set -- $i; kubectl get pods -n $1 $2 -o jsonpath='{.spec.containers[*].name}'; xargs -n1; done; done
 +
 +
 +
[[ls_containers.sh]]
 +
[[kubectl get pods -A]]
 +
[[kubectl get]] pods -A -o=name
 +
[[kubectl get --no-headers]] pods -A -o [[custom-columns]]=":metadata.name"
 +
[[kubectl get --no-headers]] pods -A -o [[custom-columns]]=":metadata.namespace,:metadata.name"
 +
[[kubectl get ns]]
 +
[[while read line]]
 +
kubectl get pods -n kube-system
 +
 +
== See also ==
 +
* {{Pod}}
 +
 +
[[Category:kubectl]]

Latest revision as of 15:19, 28 September 2023

kubectl get pods YourPOD -o jsonpath='{.spec.containers[*].name}'


cat /yourfile.txt | while read line; do for i in "$line"; do set -- $i; kubectl get pods -n $1 $2 -o jsonpath='{.spec.containers[*].name}'; xargs -n1; done; done


ls_containers.sh
kubectl get pods -A
kubectl get pods -A -o=name
kubectl get --no-headers pods -A -o custom-columns=":metadata.name" 
kubectl get --no-headers pods -A -o custom-columns=":metadata.namespace,:metadata.name" 
kubectl get ns
while read line
kubectl get pods -n kube-system

See also[edit]

Advertising: