Created
July 30, 2021 02:52
-
-
Save dkeightley/00d7fb72573406f92b2c8d196bc3b37c to your computer and use it in GitHub Desktop.
Test pods in a service from every ingress-nginx pod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SERVICE=my-nginx | |
NAMESPACE=default | |
PORT=80 | |
for ingresspod in $(kubectl -n ingress-nginx get pods -l app=ingress-nginx --template '{{range.items}}{{.metadata.name}}{{"\n"}}{{end}}') | |
do | |
echo $ingresspod | |
for svcep in $(kubectl -n $NAMESPACE get ep $SERVICE -o json | jq -r '.subsets[].addresses[].ip') | |
do | |
echo "=> ${svcep}" | |
kubectl -n ingress-nginx exec $ingresspod -- curl -o /dev/null -s -w 'Connect: %{time_connect}\nStart Transfer: %{time_starttransfer}\nTotal: %{time_total}\nResponse code: %{http_code}\n' -k http://${svcep}:${PORT} | |
echo | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment