tokers commented on a change in pull request #170:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/170#discussion_r555076411



##########
File path: docs/userguides/httpbin.md
##########
@@ -0,0 +1,107 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Proxy the httpbin service
+
+This document explains how apisix-ingress-controller guides Apache APISIX 
routes traffic to httpbin service correctly.
+
+## Prerequisites
+
+* Prepare an available Kubernetes cluster in your workstation, we recommend 
you to use [Minikube](https://github.com/kubernetes/minikube).
+* [Install Apache APISIX in Kubernetes by Helm 
Chart](https://github.com/apache/apisix-helm-chart).
+* Install 
[apisix-ingress-controller](https://github.com/apache/apisix-ingress-controller/blob/master/docs/install.md).
+
+## Deploy httpbin service
+
+We use [kennethreitz/httpbin](https://hub.docker.com/r/kennethreitz/httpbin/) 
as the service image, See its overview page for details.
+
+Now, try to deploy it to your Kubernetes cluster:
+
+```yaml
+$ 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](https://github.com/apache/apisix-ingress-controller/blob/master/docs/CRD-specification.md#apisixroute)
 for the details.
+
+```yaml
+apiVersion: apisix.apache.org/v1
+kind: ApisixRoute
+metadata:
+  name: httpserver-route
+spec:
+  rules:
+  - host: local.httpbin.org
+    http:
+      paths:
+      - backend:
+          serviceName: httpbin
+          servicePort: 8080
+        path: /hello*
+```
+
+The YAML snippet shows a simple `ApisixRoute` configuration, which tells 
Apache APISIX to route all requests with Host `local.httpbin.org` to the 
`httpbin` service.
+Now try to create it.
+
+```shell
+$ kubectl apply -f - <<EOS
+apiVersion: apisix.apache.org/v1
+kind: ApisixRoute
+metadata:
+  name: httpserver-route
+spec:
+  rules:
+  - host: test.apisix.apache.org
+    http:
+      paths:
+      - backend:
+          serviceName: httpbin
+          servicePort: 8080
+        path: /
+EOS
+```
+
+## Test
+
+Run curl call in one of Apache APISIX Pods to check whether the resource was 
delivered to it.
+
+```shell
+$ kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache 
APISIX} -- curl http://127.0.0.1:9180/apisix/admin/routes

Review comment:
       OK, will fix it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to