Non-agentic HTTP

The httpbin app lets you test out agentgateway for non-agentic HTTP traffic by sending requests to it and receiving responses.

About

Review the following diagram to understand the setup.

  flowchart LR
    A[client] -->|example.com| B[gateway proxy]
    B --> C[httpbin backend]
  • The client calls the www.example.com hostname that you set up in the Gateway configuration.
  • The agentgateway proxy receives the request. Based on the routing rules that you set up in the Gateway configuration, the gateway proxy forwards the traffic to the backend destination, which is the httpbin service. The gateway proxy is available from an external LoadBalancer service that is backed by an IP address that your cloud provider typically assigns. For testing in a local cluster where you do not have an external service, you can enable port-forwarding so that the gateway proxy listens on the localhost instead.
  • The httpbin service receives and responds to the request. Note that the httpbin service does not have to be publicly exposed because the gateway proxy handles the external traffic. Instead, it can have an internal service type, such as ClusterIP.

Before you begin

Install the agentgateway control plane.

Install httpbin

Step 1: Install the httpbin app

Install the sample httpbin app.

  1. Install the httpbin app.

    kubectl apply -f https://raw.githubusercontent.com/kgateway-dev/kgateway/refs/heads/main/examples/httpbin.yaml
  2. Verify that the httpbin app is up and running.

    kubectl get pods -n httpbin

Step 2: Create a route to the httpbin app

Create an HTTPRoute resource that routes requests to the httpbin app through the Gateway that you created before you began.

kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: httpbin
  namespace: httpbin
spec:
  parentRefs:
    - name: agentgateway-proxy
      namespace: agentgateway-system
  hostnames:
    - "www.example.com"
  rules:
    - backendRefs:
        - name: httpbin
          port: 8000
EOF

Step 3: Send a request to the httpbin app

Send a request to the httpbin app through the agentgateway proxy.

  1. Get the external address of the gateway proxy and save it in an environment variable.

    export INGRESS_GW_ADDRESS=$(kubectl get svc -n agentgateway-system agentgateway-proxy -o=jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}")
    echo $INGRESS_GW_ADDRESS
  2. Send a request to the httpbin app and verify that you get back a 200 HTTP response code. Note that it might take a few seconds for the load balancer service to become fully ready and accept traffic.

    curl -i http://$INGRESS_GW_ADDRESS:80/headers -H "host: www.example.com"

    Example output:

    HTTP/1.1 200 OK
    access-control-allow-credentials: true
    access-control-allow-origin: *
    content-type: application/json; encoding=utf-8
    date: Thu, 13 Feb 2025 18:49:32 GMT
    content-length: 330
    x-envoy-upstream-service-time: 4
    server: envoy
    {
      "headers": {
       "Accept": [
         "*/*"
       ],
       "Host": [
         "www.example.com"
       ],
       "User-Agent": [
         "curl/8.7.1"
       ]
     }
    }
  1. Port-forward the gateway proxy http pod on port 8080.

    kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80
  2. Send a request to the httpbin app and verify that you get back a 200 HTTP response code.

    curl -i localhost:8080/headers -H "host: www.example.com"

    Example output:

    HTTP/1.1 200 OK
    access-control-allow-credentials: true
    access-control-allow-origin: *
    content-type: application/json; encoding=utf-8
    date: Thu, 13 Feb 2025 18:49:32 GMT
    content-length: 330
    x-envoy-upstream-service-time: 4
    server: envoy
    {
      "headers": {
        "Accept": [
          "*/*"
        ],
        "Host": [
          "www.example.com"
        ],
        "User-Agent": [
          "curl/8.7.1"
        ]
      }
    }

Next steps

Now that you have agentgateway set up and running, check out the following guides to expand your API gateway capabilities.

Cleanup

You can remove the resources that you created in this guide.
  1. Delete the httpbin app.

    kubectl delete -f https://raw.githubusercontent.com/kgateway-dev/kgateway/refs/heads/main/examples/httpbin.yaml
  2. Delete the HTTPRoute.

    kubectl delete httproute httpbin -n httpbin
  3. Delete the Gateway.

    kubectl delete gateway http -n agentgateway-system
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

↑↓ navigate select esc dismiss

What could be improved?