Skip to content

Instantly share code, notes, and snippets.

@dkeightley
Last active February 2, 2020 21:21
Show Gist options
  • Save dkeightley/4712a4d1f47b1f8a76f7c793d7fc59c4 to your computer and use it in GitHub Desktop.
Save dkeightley/4712a4d1f47b1f8a76f7c793d7fc59c4 to your computer and use it in GitHub Desktop.
Rancher ingress to Pod curl
SERVICE=nginx
NAMESPACE=default
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}
echo
done
done
@dkeightley
Copy link
Author

Adjust the protocol/port as needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment