This is an automated email from the ASF dual-hosted git repository.
wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new e58e6d6 doc: update develop.md (#129)
e58e6d6 is described below
commit e58e6d6b518b24fa168dc8e9c04c1cf7997a41e1
Author: Alex Zhang <[email protected]>
AuthorDate: Fri Dec 25 15:17:12 2020 +0800
doc: update develop.md (#129)
* doc: update develop.md
* fix: add httpbin deployment/service yaml in docs/develop.md
---
docs/develop.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 52 insertions(+), 6 deletions(-)
diff --git a/docs/develop.md b/docs/develop.md
index 3a63ab6..d2502a5 100644
--- a/docs/develop.md
+++ b/docs/develop.md
@@ -37,15 +37,59 @@ Tips: The Kubernetes cluster deployment method is
recommended for production and
[Install Apache APISIX in
Kubernetes](https://github.com/apache/apisix/tree/master/kubernetes)
+### 3. httpbin service
+
+Deploy [httpbin](https://github.com/postmanlabs/httpbin) to your Kubernetes
cluster and expose it as a Service. For instance:
+
+```yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: httpbin
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: httpbin
+ template:
+ metadata:
+ labels:
+ app: httpbin
+ spec:
+ terminationGracePeriodSeconds: 0
+ containers:
+ - name: httpbin
+ image: "kennethreitz/httpbin"
+ imagePullPolicy: IfNotPresent
+ ports:
+ - containerPort: 80
+ name: "http"
+ protocol: "TCP"
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: httpbin
+spec:
+ selector:
+ app: httpbin
+ ports:
+ - name: http
+ port: 8080
+ protocol: TCP
+ targetPort: 80
+ type: ClusterIP
+```
+
## Configuration
-### Configure the `kube config` file locally to facilitate local debugging
+### Configure the kubeconfig file locally to facilitate local debugging
1. Start minikube.
2. Location: ~/.kube/config
-3. Copy the config file to your local development environment, the path should
be configured in apisix-ingress-controller by specifying `--kuebconfig` option.
+3. Copy the config file to your local development environment, the path should
be configured in apisix-ingress-controller by specifying `--kubeconfig` option.
### Configure APISIX service address
@@ -68,7 +112,7 @@ Tips: The program may print some error logs, indicating that
the resource cannot
### Define ApisixRoute
-Take the back-end service `httpserver` as an example (you can choose any
upstream service for test).
+Take the backend service `httpbin` as an example (you can choose any other
upstream services for test).
In fact, in order to reduce the trouble caused by ingress migration, we try to
keep the structure of ApisixRoute consistent with the original ingress.
@@ -89,12 +133,14 @@ spec:
http:
paths:
- backend:
- serviceName: httpserver
+ serviceName: httpbin.default.svc.cluster.local
servicePort: 8080
path: /hello*
EOF
```
+Here we use the FQDN `httpbin.default.svc.cluster.local` as the `serviceName`,
and the service port is 8080, change them if your `httpbin` service has a
different name, namespace or port.
+
In addition, `ApisixRoute` also continues to support the definition with
annotation, you can also define as below.
```yaml
@@ -115,7 +161,7 @@ spec:
http:
paths:
- backend:
- serviceName: httpserver
+ serviceName: httpbin.default.svc.cluster.local
servicePort: 8080
path: /hello*
plugins:
@@ -165,7 +211,7 @@ kubectl apply -f - <<EOF
apiVersion: apisix.apache.org/v1
kind: ApisixUpstream # apisix upstream
metadata:
- name: httpserver # default/httpserver
+ name: httpbin # default/httpbin
spec:
ports:
- port: 8080