Last active
December 7, 2018 20:29
-
-
Save coderfi/4a04aa666e0ff0db7e7416d1253f736d to your computer and use it in GitHub Desktop.
Istio Gateway Host and Port discovery (minikube or cluster)
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
#!/usr/bin/env bash | |
# Usage: | |
# eval $(bash ./gateway-env.sh) | |
# Author: [email protected] | |
INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}') | |
if [[ "${INGRESS_HOST}" == "" ]]; then | |
# assume minikube | |
INGRESS_HOST=$(minikube ip) | |
INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}') | |
else | |
INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}') | |
fi | |
echo export INGRESS_HOST=$INGRESS_HOST | |
echo export INGRESS_PORT=$INGRESS_PORT | |
if [[ "${INGRESS_PORT}" != "80" ]]; then | |
echo export GATEWAY_URL=http://$INGRESS_HOST:$INGRESS_PORT | |
else | |
echo export GATEWAY_URL=http://$INGRESS_HOST | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wrote this to find the ISTIO gateway url, whether it is minikube or a kubernetes cluster.