Thursday, 5 October 2023

How to prints out the environment variables within each pod of k8s

 

for pod in $(kubectl get po --all-namespaces --output=jsonpath={.items..metadata.name}); do   namespace=$(kubectl get po --all-namespaces --field-selector=metadata.name=$pod --output=jsonpath={.items..metadata.namespace});   echo "Pod: $pod (Namespace: $namespace)";   kubectl exec -it -n $namespace $pod -- env; done




No comments:

Post a Comment