Expose the UI via HTTPS
Expose the Gloo UI with an HTTPS listener on your gateway proxy.
You can expose the UI on an HTTPS listener. Exposing it on an HTTP listener is currently not supported.
Before you begin
Follow the Get started guide to install Gloo Gateway, set up a gateway resource, and deploy the httpbin sample app.
Make sure that you have the OpenSSL version of openssl, not LibreSSL. The openssl version must be at least 1.1.
- Check your
opensslversion. If you see LibreSSL in the output, continue to the next step.openssl version - Install the OpenSSL version (not LibreSSL). For example, you might use Homebrew.
brew install openssl - Review the output of the OpenSSL installation for the path of the binary file. You can choose to export the binary to your path, or call the entire path whenever the following steps use an
opensslcommand.- For example,
opensslmight be installed along the following path:/usr/local/opt/openssl@3/bin/ - To run commands, you can append the path so that your terminal uses this installed version of OpenSSL, and not the default LibreSSL.
/usr/local/opt/openssl@3/bin/openssl req -new -newkey rsa:4096 -x509 -sha256 -days 3650...
- For example,
- Check your
Create a TLS certificate
Create a TLS certificate that you use to secure your HTTPS listener.
Create a directory to store your TLS credentials in.
mkdir example_certsCreate a self-signed root certificate. The following command creates a root certificate that is valid for a year and can serve any hostname. You use this certificate to sign the server certificate for the gateway later. For other command options, see the OpenSSL docs.
# root cert openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -subj '/O=any domain/CN=*' -keyout example_certs/root.key -out example_certs/root.crtWhen generating your Envoy certificates, make sure to use encryption algorithms that are supported in Envoy. To learn more about supported algorithms that you can use for your certificates and keys, see the Envoy documentation.Use the root certificate to sign the gateway certificate.
openssl req -out example_certs/gateway.csr -newkey rsa:2048 -nodes -keyout example_certs/gateway.key -subj "/CN=*/O=any domain" openssl x509 -req -sha256 -days 365 -CA example_certs/root.crt -CAkey example_certs/root.key -set_serial 0 -in example_certs/gateway.csr -out example_certs/gateway.crtCreate a Kubernetes secret to store your server TLS certificate. You create the secret in the same cluster and namespace that the gateway is deployed to. Optionally, you can label the secret to make it easier to refer to later.
kubectl create secret tls -n gloo-system https \ --key example_certs/gateway.key \ --cert example_certs/gateway.crt kubectl label secret https gateway=https --namespace gloo-system
Expose the UI on the gateway
Create a Gateway resource and configure an HTTPS listener.
kubectl apply -f- <<EOF apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: https-ui namespace: gloo-system labels: gateway: https-ui spec: gatewayClassName: gloo-gateway listeners: - name: https port: 443 protocol: HTTPS hostname: ui.example.com tls: mode: Terminate certificateRefs: - name: https kind: Secret allowedRoutes: namespaces: from: All EOFCreate an Upstream that represents the Gloo UI.
kubectl apply -f- <<EOF apiVersion: gloo.solo.io/v1 kind: Upstream metadata: name: gloo-mesh-ui namespace: gloo-system labels: gateway: https-ui spec: kube: serviceName: gloo-mesh-ui serviceNamespace: gloo-system servicePort: 8090 protocolSelection: USE_DOWNSTREAM_PROTOCOL EOFCreate the HTTPRoute that routes incoming traffic on the
/path prefix to the Gloo UI Upstream and attach it to your HTTPS Gateway that you created earlier.kubectl apply -f- <<EOF apiVersion: gateway.networking.k8s.io/v1beta1 kind: HTTPRoute metadata: name: gloo-mesh-ui-http namespace: gloo-system labels: gateway: https-ui spec: parentRefs: - name: https-ui namespace: gloo-system rules: - backendRefs: - kind: Upstream group: gloo.solo.io name: gloo-mesh-ui matches: - path: type: PathPrefix value: / EOFGet the external address of the Gateway and save it in an environment variable. Note that it might take a few seconds for the Gateway address to become available.
To access the Gloo UI with you web browser, edit the
/etc/hostsfile on your local machine to map the IP address of the gateway proxy to theui.example.comdomain.Open the
/etc/hostsfile.sudo nano /etc/hostsMap the gateway proxy IP address to the
ui.example.comdomain. To retrieve the IP address that is assigned to your load balancer hostname, usedig +short $INGRESS_GW_ADDRESS | head -n1.<IP address or 127.0.0.1 for localhost> ui.example.comOpen the Gloo UI in your web browser.
open https://ui.example.com:8443

Cleanup
You can optionally remove the resources that you created as part of this guide.
Remove the HTTPRoute, Upstream, and HTTPS Gateway.
kubectl delete httproute,upstream,gateway -A -l gateway=https-uiRemove the Kubernetes secret that holds the TLS certificate.
kubectl delete secret https -n gloo-systemRemove the
example_certsdirectory that stores your TLS credentials.rm -rf example_certs