Skip to content

Files

Latest commit

 

History

History

pods

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
  1. Get the IP of the pods with label app=nginx.
    K8s version used - v1.19.5
Click to expand!
kubectl get pods -l app=nginx -o jsonpath='{range .items[*]}{.status.podIP}{"\n"}{end}'

Output

10.38.0.2
10.32.0.3
10.32.0.4
10.38.0.1
  1. Get all the pods that are on specific node. Change the node name according to your requirement in @.spec.nodeName=="kubenode01"
    K8s version used - v1.19.5
Click to expand!
kubectl get pods -o jsonpath='{range $.items[?(@.spec.nodeName=="kubenode01")]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}{end}'

Output

nginx-6799fc88d8-78mwd  kubenode01
nginx-6799fc88d8-c7cpb  kubenode01
test-iptables-cb64cc545-dn9t8   kubenode01
  1. Get all the pods that are using specific configmap. Change the configmap name according to your requirement in @.spec.volumes[*].configMap.name=="test-config"
    K8s version used - v1.19.2
Click to expand!
kubectl get pods -o jsonpath='{range .items[?(@.spec.volumes[*].configMap.name=="test-config")]}{.metadata.name}{"\t"}{.spec.volumes[*].configMap.name}{"\n"}{end}'

Output

test-pod-cm     test-config
  1. Get all the pods that are using specific persistent volume claim. Change the pvc name according to your requirement in @.spec.volumes[*].persistentVolumeClaim.claimName=="test-pvc"
    K8s version used - v1.19.5
Click to expand!
kubectl get pods -o jsonpath='{range .items[?(@.spec.volumes[*].persistentVolumeClaim.claimName=="test-pvc")]}{.metadata.name}{"\t"}{"\n"}{end}'

Output

test-pod-pvc