Skip to main content
Version: 1.5.0

Proxy the httpbin service

This document explains how apisix-ingress-controller guides Apache APISIX routes traffic to httpbin service correctly.


Deploy httpbin service#

We use kennethreitz/httpbin as the service image, See its overview page for details.

Now, try to deploy it to your Kubernetes cluster:

kubectl run httpbin --image kennethreitz/httpbin --port 80
kubectl expose pod httpbin --port 80

Resource Delivery#

In order to let Apache APISIX proxies requests to httpbin, we need to create an ApisixRoute resource, if you're not familiar with it, see the reference for the details.

# httpbin-route.yaml
kind: ApisixRoute
name: httpserver-route
- name: rule1
- /*
- serviceName: httpbin
servicePort: 80

The YAML snippet shows a simple ApisixRoute configuration, which tells Apache APISIX to route all requests with Host to the httpbin service. Now try to create it.

kubectl apply -f httpbin-route.yaml


Run curl call in one of Apache APISIX Pods to check whether the resource was delivered to it. Note you should replace the value of --default-apisix-cluster-admin-key to the real admin_key value in your Apache APISIX cluster.

kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} -- curl -H 'X-API-Key: edd1c9f034335f136f87ad84b625c8f1'

And request to Apache APISIX to verify the route.

kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} -- curl -H 'Host:'

In case of success, you'll see a JSON string which contains all requests headers carried by curl like:

"headers": {
"Accept": "*/*",
"Host": "",
"User-Agent": "curl/7.64.1",
"X-Amzn-Trace-Id": "Root=1-5ffc3273-2928e0844e19c9810d1bbd8a"