content/en/docs/tasks/observability/gateways/index.md
This task shows how to configure Istio to expose and access the telemetry addons outside of a cluster.
Remote access to the telemetry addons can be configured in a number of different ways. This task covers two basic access methods: secure (via HTTPS) and insecure (via HTTP). The secure method is strongly recommended for any production or sensitive environment. Insecure access is simpler to set up, but will not protect any credentials or data transmitted outside of your cluster.
For both options, first follow these steps:
Install Istio in your cluster.
To additionally install the telemetry addons, follow the integrations documentation.
Set up the domain to expose addons. In this example, you expose each addon on a subdomain, such as grafana.example.com.
istio-ingressgateway (say example.com):{{< text bash >}} $ export INGRESS_DOMAIN="example.com" {{< /text >}}
nip.io which will automatically resolve to the IP address provided. This is not recommended for production usage.{{< text bash >}} $ export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') $ export INGRESS_DOMAIN=${INGRESS_HOST}.nip.io {{< /text >}}
A server certificate is required for secure access. Follow these steps to install and configure server certificates for a domain that you control.
{{< warning >}} This option covers securing the transport layer only. You should also configure the telemetry addons to require authentication when exposing them externally. {{< /warning >}}
This example uses self-signed certificates, which may not be appropriate for production usages. For these cases, consider using cert-manager or other tools to provision certificates. You may also visit the Securing Gateways with HTTPS task for general information on using HTTPS on the gateway.
Set up the certificates. This example uses openssl to self sign.
{{< text bash >}} $ CERT_DIR=/tmp/certs $ mkdir -p ${CERT_DIR} $ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -subj "/O=example Inc./CN=.${INGRESS_DOMAIN}" -keyout ${CERT_DIR}/ca.key -out ${CERT_DIR}/ca.crt $ openssl req -out ${CERT_DIR}/cert.csr -newkey rsa:2048 -nodes -keyout ${CERT_DIR}/tls.key -subj "/CN=.${INGRESS_DOMAIN}/O=example organization" $ openssl x509 -req -sha256 -days 365 -CA ${CERT_DIR}/ca.crt -CAkey ${CERT_DIR}/ca.key -set_serial 0 -in ${CERT_DIR}/cert.csr -out ${CERT_DIR}/tls.crt $ kubectl create -n istio-system secret tls telemetry-gw-cert --key=${CERT_DIR}/tls.key --cert=${CERT_DIR}/tls.crt {{< /text >}}
Apply networking configuration for the telemetry addons.
Apply the following configuration to expose Grafana:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: grafana-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: grafana-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/grafana-gateway created virtualservice.networking.istio.io/grafana-vs created destinationrule.networking.istio.io/grafana created {{< /text >}}
Apply the following configuration to expose Kiali:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: kiali-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: kiali-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/kiali-gateway created virtualservice.networking.istio.io/kiali-vs created destinationrule.networking.istio.io/kiali created {{< /text >}}
Apply the following configuration to expose Prometheus:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: prometheus-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: prometheus-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/prometheus-gateway created virtualservice.networking.istio.io/prometheus-vs created destinationrule.networking.istio.io/prometheus created {{< /text >}}
Apply the following configuration to expose the tracing service:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: tracing-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: tracing-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/tracing-gateway created virtualservice.networking.istio.io/tracing-vs created destinationrule.networking.istio.io/tracing created {{< /text >}}
Visit the telemetry addons via your browser.
{{< warning >}} If you used self signed certificates, your browser will likely mark them as insecure. {{< /warning >}}
https://kiali.${INGRESS_DOMAIN}https://prometheus.${INGRESS_DOMAIN}https://grafana.${INGRESS_DOMAIN}https://tracing.${INGRESS_DOMAIN}Apply networking configuration for the telemetry addons.
Apply the following configuration to expose Grafana:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: grafana-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: grafana-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/grafana-gateway created virtualservice.networking.istio.io/grafana-vs created destinationrule.networking.istio.io/grafana created {{< /text >}}
Apply the following configuration to expose Kiali:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: kiali-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: kiali-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/kiali-gateway created virtualservice.networking.istio.io/kiali-vs created destinationrule.networking.istio.io/kiali created {{< /text >}}
Apply the following configuration to expose Prometheus:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: prometheus-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: prometheus-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/prometheus-gateway created virtualservice.networking.istio.io/prometheus-vs created destinationrule.networking.istio.io/prometheus created {{< /text >}}
Apply the following configuration to expose the tracing service:
{{< text bash >}} $ cat <<EOF | kubectl apply -f - apiVersion: networking.istio.io/v1 kind: Gateway metadata: name: tracing-gateway namespace: istio-system spec: selector: istio: ingressgateway servers:
apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: tracing-vs namespace: istio-system spec: hosts:
EOF gateway.networking.istio.io/tracing-gateway created virtualservice.networking.istio.io/tracing-vs created destinationrule.networking.istio.io/tracing created {{< /text >}}
Visit the telemetry addons via your browser.
http://kiali.${INGRESS_DOMAIN}http://prometheus.${INGRESS_DOMAIN}http://grafana.${INGRESS_DOMAIN}http://tracing.${INGRESS_DOMAIN}Remove all related Gateways:
{{< text bash >}} $ kubectl -n istio-system delete gateway grafana-gateway kiali-gateway prometheus-gateway tracing-gateway gateway.networking.istio.io "grafana-gateway" deleted from istio-system namespace gateway.networking.istio.io "kiali-gateway" deleted from istio-system namespace gateway.networking.istio.io "prometheus-gateway" deleted from istio-system namespace gateway.networking.istio.io "tracing-gateway" deleted from istio-system namespace {{< /text >}}
Remove all related Virtual Services:
{{< text bash >}} $ kubectl -n istio-system delete virtualservice grafana-vs kiali-vs prometheus-vs tracing-vs virtualservice.networking.istio.io "grafana-vs" deleted from istio-system namespace virtualservice.networking.istio.io "kiali-vs" deleted from istio-system namespace virtualservice.networking.istio.io "prometheus-vs" deleted from istio-system namespace virtualservice.networking.istio.io "tracing-vs" deleted from istio-system namespace {{< /text >}}
Remove all related Destination Rules:
{{< text bash >}} $ kubectl -n istio-system delete destinationrule grafana kiali prometheus tracing destinationrule.networking.istio.io "grafana" deleted from istio-system namespace destinationrule.networking.istio.io "kiali" deleted from istio-system namespace destinationrule.networking.istio.io "prometheus" deleted from istio-system namespace destinationrule.networking.istio.io "tracing" deleted from istio-system namespace {{< /text >}}