Set up Gloo Gateway in a Kubernetes cluster.
Gloo Gateway is a cloud-native Layer 7 proxy that is based on the Kubernetes Gateway API.
Set up Gloo Gateway v2
You can deploy Gloo Gateway v2 by using the
helm command line tools.
Deploy a sample app
Create the httpbin namespace.
kubectl create ns httpbin
Deploy the httpbin app.
kubectl -n httpbin apply -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/httpbin.yaml
Verify that the httpbin app is running.
kubectl -n httpbin get pods
NAME READY STATUS RESTARTS AGE httpbin-d57c95548-nz98t 3/3 Running 0 18s
Expose the app on the gateway
Create an HTTPRoute resource to expose the httpbin app on the gateway. The following example exposes the app on the
kubectl apply -f- <<EOF apiVersion: gateway.networking.k8s.io/v1beta1 kind: HTTPRoute metadata: name: httpbin namespace: httpbin labels: example: httpbin-route spec: parentRefs: - name: http namespace: gloo-system hostnames: - "www.example.com" rules: - backendRefs: - name: httpbin port: 8000 EOF
The name and namespace of the gateway resource that serves the route. In this example, you use the HTTP gateway that you created earlier.
A list of hostnames that the route is exposed on.
The Kubernetes service that serves the incoming request. In this example, requests to
www.example.comare forwarded to the httpbin app on port 9000. Note that you must create the HTTP route in the same namespace as the service that serves that route. To create the HTTP route resource in a different namespace, you must create a ReferenceGrant resource to allow the HTTP route to forward requests to a service in a different namespace. For more information, see the Kubernetes API Gateway documentation.
Verify that the HTTPRoute is applied successfully.
kubectl get -n httpbin httproute/httpbin -o yaml
Send a request to the httpbin app.
Now that you have Gloo Gateway v2 set up and running, check out the following guides to expand your API gateway capabilities.
- Learn more about Gloo Gateway v2, its features and benefits.
- Add routing capabilities to your httpbin route by using the Traffic management guides.
If you no longer need this quick-start Gloo Gateway v2 environment, you can uninstall your setup by following the steps in the Uninstall guide.