1. Create a gateway resource with an HTTP listener.

      kubectl apply -f- <<EOF
    apiVersion: gateway.networking.k8s.io/v1
    kind: Gateway
      name: my-http-gateway
      namespace: gloo-system
        example: httpbin-mydomain
      gatewayClassName: gloo-gateway
      - protocol: HTTP
        port: 8080
        hostname: mydomain.com
        name: http
            from: All
    spec.gatewayClassNameThe name of the Kubernetes gateway class that you want to use to configure the gateway. When you set up Gloo Gateway, a default gateway class is set up for you. To view the gateway class configuration, see Gateway classes and types.
    spec.listenersConfigure the listeners for this gateway. In this example, you configure an HTTP gateway that listens for incoming traffic for the mydomain.com domain on port 8080. The gateway can serve HTTP routes from any namespace.
  2. Check the status of the gateway to make sure that your configuration is accepted and no conflicts exist in your cluster.

      kubectl get gateway my-http-gateway -n gloo-system -o yaml
  3. Create an HTTPRoute resource for the httpbin app that is served by the gateway that you created.

      kubectl apply -f- <<EOF
    apiVersion: gateway.networking.k8s.io/v1beta1
    kind: HTTPRoute
      name: httpbin-mydomain
      namespace: httpbin
        example: httpbin-mydomain
        - name: my-http-gateway
          namespace: gloo-system
        - backendRefs:
            - name: httpbin
              port: 8000
  4. Verify that the HTTPRoute is applied successfully.

      kubectl get httproute/httpbin-mydomain -n httpbin -o yaml
  5. Get the external address of the gateway and save it in an environment variable.

  6. Send a request to the httpbin app and verify that you get back a 200 HTTP response code.

    Example output:

      * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    HTTP/1.1 200 OK
    < access-control-allow-credentials: true
    access-control-allow-credentials: true
    < access-control-allow-origin: *
    access-control-allow-origin: *
    < date: Fri, 03 Nov 2023 20:02:48 GMT
    date: Fri, 03 Nov 2023 20:02:48 GMT
    < content-length: 0
    content-length: 0
    < x-envoy-upstream-service-time: 1
    x-envoy-upstream-service-time: 1
    < server: envoy
    server: envoy
  7. Optional: If you no longer need the HTTP listener, clean up the resources that you created.

      kubectl delete -A gateways,httproutes -l example=httpbin-mydomain