HTTPBin is an open source application for testing and is commonly used for web debugging. After you deploy the HTTPBin application, you can easily view the methods, headers, and authorization information of HTTP requests. This topic describes how to deploy the HTTPBin application.
Prerequisites
Procedure
Deploy the HTTPBin application in the Container Service for Kubernetes (ACK) cluster on the data plane.
Use the following content to create an httpbin-application.yaml file:
Use kubectl to connect to the ACK cluster and run the following command to deploy the HTTPBin application:
kubectl apply -f httpbin-application.yaml
Configure a traffic rule for the HTTPBin application.
Use the following content to create an Istio gateway. For more information, see Manage Istio gateways.
apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata: name: httpbin namespace: default spec: selector: istio: ingressgateway servers: - hosts: - '*' port: name: test number: 80 protocol: HTTP
Use the following content to create a virtual service. For more information, see Manage virtual services.
apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: httpbin-vs namespace: default spec: gateways: - httpbin hosts: - '*' http: - name: test route: - destination: host: httpbin.default.svc.cluster.local port: number: 8000
Perform access tests.
Replace the
IP address of the ASM gateway
in the following commands with the actual IP address of the ASM gateway. For more information about how to obtain the IP address of an ASM gateway, see Obtain the IP address of the ingress gateway.Run the following command to access the
/status/200
path of the HTTPBin application:curl http://${IP address of the ASM gateway}/status/200 -v
200 OK
is returned.Run the following command to access the
/status/418
path of the HTTPBin application:curl http://${IP address of the ASM gateway}/status/418 -v
418 Unknown
is returned.Run the following command to access the
/status/403
path of the HTTPBin application:curl http://${IP address of the ASM gateway}/status/403 -v
403 Forbidden
is returned.Run the following command to access the
/headers
path of the HTTPBin application:curl http://${IP address of the ASM gateway}/headers -H test-header:test-value -v
The response contains the headers carried in the request.