Add instructions for accessing ingress gateway installed using Helm (#12308)

* Add instructions for accessing ingress gateway installed using Helm

* typo

* fix label selector

* regen

* remove extra space
This commit is contained in:
Frank Budinsky 2022-11-29 13:40:18 -05:00 committed by GitHub
parent a1588f5d2c
commit fd22c1babf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 32 deletions

View File

@ -222,10 +222,27 @@ Set the `INGRESS_HOST` and `INGRESS_PORT` environment variables according to the
{{< tab name="Istio classic" category-value="istio-classic" >}}
If you are unsure, you can determine if your Kubernetes cluster is running in an environment that supports external load balancers using the following command:
Set the following environment variables to the name and namespace where the Istio ingress gateway is located in your cluster:
{{< text bash >}}
$ kubectl get svc istio-ingressgateway -n istio-system
$ export INGRESS_NAME=istio-ingressgateway
$ export INGRESS_NS=istio-system
{{< /text >}}
{{< tip >}}
If you installed Istio using Helm, the ingress gateway name and namespace are both `istio-ingress`:
{{< text bash >}}
$ export INGRESS_NAME=istio-ingress
$ export INGRESS_NS=istio-ingress
{{< /text >}}
{{< /tip >}}
Run the following command to determine if your Kubernetes cluster is in an environment that supports external load balancers:
{{< text bash >}}
$ kubectl get svc "$INGRESS_NAME" -n "$INGRESS_NS"
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway LoadBalancer 172.21.109.129 130.211.10.121 ... 17h
{{< /text >}}
@ -238,10 +255,10 @@ If your environment does not support external load balancers, you can try
Otherwise, set the ingress IP and ports using the following commands:
{{< text bash >}}
$ export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
$ export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
$ export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')
$ export TCP_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="tcp")].port}')
$ export INGRESS_HOST=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
$ export INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
$ export SECURE_INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="https")].port}')
$ export TCP_INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="tcp")].port}')
{{< /text >}}
{{< warning >}}
@ -251,7 +268,7 @@ but rather a host name, and the above command will have failed to set the `INGRE
Use the following command to correct the `INGRESS_HOST` value:
{{< text bash >}}
$ export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
$ export INGRESS_HOST=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
{{< /text >}}
{{< /warning >}}
@ -429,9 +446,9 @@ using the `istio-ingressgateway` service's [node ports](https://kubernetes.io/do
Set the ingress ports:
{{< text bash >}}
$ export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
$ export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
$ export TCP_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="tcp")].nodePort}')
$ export INGRESS_PORT=$(kubectl -n "${INGRESS_NS}" get service "${INGRESS_NAME}" -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
$ export SECURE_INGRESS_PORT=$(kubectl -n "${INGRESS_NS}" get service "${INGRESS_NAME}" -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
$ export TCP_INGRESS_PORT=$(kubectl -n "${INGRESS_NS}" get service "${INGRESS_NAME}" -o jsonpath='{.spec.ports[?(@.name=="tcp")].nodePort}')
{{< /text >}}
Setting the ingress IP depends on the cluster provider:
@ -466,7 +483,7 @@ Setting the ingress IP depends on the cluster provider:
1. _Other environments:_
{{< text bash >}}
$ export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}')
$ export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n "${INGRESS_NS}" -o jsonpath='{.items[0].status.hostIP}')
{{< /text >}}
## Troubleshooting

View File

@ -125,31 +125,41 @@ minikube tunnel
}
snip_determining_the_ingress_ip_and_ports_2() {
kubectl get svc istio-ingressgateway -n istio-system
export INGRESS_NAME=istio-ingressgateway
export INGRESS_NS=istio-system
}
! read -r -d '' snip_determining_the_ingress_ip_and_ports_2_out <<\ENDSNIP
snip_determining_the_ingress_ip_and_ports_3() {
export INGRESS_NAME=istio-ingress
export INGRESS_NS=istio-ingress
}
snip_determining_the_ingress_ip_and_ports_4() {
kubectl get svc "$INGRESS_NAME" -n "$INGRESS_NS"
}
! read -r -d '' snip_determining_the_ingress_ip_and_ports_4_out <<\ENDSNIP
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway LoadBalancer 172.21.109.129 130.211.10.121 ... 17h
ENDSNIP
snip_determining_the_ingress_ip_and_ports_3() {
export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')
export TCP_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="tcp")].port}')
}
snip_determining_the_ingress_ip_and_ports_4() {
export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
}
snip_determining_the_ingress_ip_and_ports_5() {
export INGRESS_HOST=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
export SECURE_INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="https")].port}')
export TCP_INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="tcp")].port}')
}
snip_determining_the_ingress_ip_and_ports_6() {
export INGRESS_HOST=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
}
snip_determining_the_ingress_ip_and_ports_7() {
export INGRESS_HOST=$(kubectl get gtw httpbin-gateway -o jsonpath='{.status.addresses[*].value}')
export INGRESS_PORT=$(kubectl get gtw httpbin-gateway -o jsonpath='{.spec.listeners[?(@.name=="http")].port}')
}
snip_determining_the_ingress_ip_and_ports_6() {
snip_determining_the_ingress_ip_and_ports_8() {
export INGRESS_HOST=$(kubectl get gtw my-gateway -o jsonpath='{.status.addresses[*].value}')
export SECURE_INGRESS_PORT=$(kubectl get gtw my-gateway -o jsonpath='{.spec.listeners[?(@.name=="https")].port}')
}
@ -246,9 +256,9 @@ EOF
}
snip_using_node_ports_of_the_ingress_gateway_service_1() {
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export TCP_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="tcp")].nodePort}')
export INGRESS_PORT=$(kubectl -n "${INGRESS_NS}" get service "${INGRESS_NAME}" -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n "${INGRESS_NS}" get service "${INGRESS_NAME}" -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
export TCP_INGRESS_PORT=$(kubectl -n "${INGRESS_NS}" get service "${INGRESS_NAME}" -o jsonpath='{.spec.ports[?(@.name=="tcp")].nodePort}')
}
snip_using_node_ports_of_the_ingress_gateway_service_2() {
@ -270,7 +280,7 @@ export INGRESS_HOST=127.0.0.1
}
snip_using_node_ports_of_the_ingress_gateway_service_6() {
export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}')
export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n "${INGRESS_NS}" -o jsonpath='{.items[0].status.hostIP}')
}
snip_troubleshooting_1() {

View File

@ -38,7 +38,7 @@ if [ "$GATEWAY_API" == "true" ]; then
snip_configuring_ingress_using_a_gateway_5
# set INGRESS_HOST and INGRESS_PORT environment variables
snip_determining_the_ingress_ip_and_ports_5
snip_determining_the_ingress_ip_and_ports_7
else
# create the gateway and routes
snip_configuring_ingress_using_a_gateway_1
@ -49,10 +49,11 @@ else
_wait_for_istio virtualservice default httpbin
# check for external load balancer
_verify_like snip_determining_the_ingress_ip_and_ports_2 "$snip_determining_the_ingress_ip_and_ports_2_out"
snip_determining_the_ingress_ip_and_ports_2
_verify_like snip_determining_the_ingress_ip_and_ports_4 "$snip_determining_the_ingress_ip_and_ports_4_out"
# set INGRESS_HOST, INGRESS_PORT, SECURE_INGRESS_PORT, and TCP_INGRESS_PORT environment variables
snip_determining_the_ingress_ip_and_ports_3
snip_determining_the_ingress_ip_and_ports_5
fi
# access the httpbin service