Forum Navigation
You need to log in to create posts and topics.

scripting shell commands on multiple containers

Problem

User wants to execute multiple commands and get the results

Solution

#!/bin/sh

for i in $(kubectl get pods -n tracston | awk ‘{print $1}’); do
echo “$i”
kubectl exec -it $i -n tracston — bash -c “env | grep TZ”
done

Uploaded files: