Skip to content

Instantly share code, notes, and snippets.

@koenighotze
Last active January 12, 2021 13:13
Show Gist options
  • Save koenighotze/5c96f97e8663d008b3b1740b5798afdf to your computer and use it in GitHub Desktop.
Save koenighotze/5c96f97e8663d008b3b1740b5798afdf to your computer and use it in GitHub Desktop.
Dump virtual service mappings for all namespaces for a Istio service mesh
#!/usr/bin/env bash
for ns in $(kubectl get ns -o=jsonpath='{.items[*].metadata.name}' | sort); do
echo Namespace: $ns
kubectl get vs \
-n $ns ${ns}-master \
-o=jsonpath='{" Destination: "}{.spec.http[*].route[*].destination.host}{"\n Regex mapping:\n "}{range .spec.http[*].match[*]}{.uri.regex}{"\n "}{end}{"\n"}{"\n Prefix mapping:\n "}{range .spec.http[*].match[*]}{.uri.prefix}{"\n "}{end}' 2>/dev/null \
|| echo "No istio virtual services"
echo
echo
done
@koenighotze
Copy link
Author

A simple gist for dumping all http info from all virtual services

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