Document xip.io with ambassador. (#1839)

Note that I haven't been able to verify this due to: https://github.com/datawire/ambassador/issues/1871
This commit is contained in:
Matt Moore 2019-10-02 09:19:05 -07:00 committed by Knative Prow Robot
parent aad87199b3
commit 026acebf9f
1 changed files with 46 additions and 29 deletions

View File

@ -27,21 +27,15 @@ The following commands install all available Knative components as well as the
standard set of observability plugins. To customize your Knative installation,
see Performing a Custom Knative Installation.
1. To install Knative, first install the CRDs by running the `kubectl apply`
command once with the `-l knative.dev/crd-install=true` flag. This prevents
race conditions during the install, which cause intermittent errors:
1. To install Knative, first install the CRDs by running the following `kubectl apply`
command. This prevents race conditions during the install, which cause intermittent errors:
kubectl apply -l knative.dev/crd-install=true \
--filename https://github.com/knative/serving/releases/download/{{< version >}}/serving.yaml \
--filename https://github.com/knative/serving/releases/download/{{< version >}}/monitoring.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/{{< version >}}/serving-crds.yaml
2. To complete the install of Knative and its dependencies, run the
`kubectl apply` command again, this time without the
`-l knative.dev/crd-install=true`:
2. To complete the install of Knative and its dependencies, next run the
following `kubectl apply` command:
kubectl apply \
--filename https://github.com/knative/serving/releases/download/{{< version >}}/serving.yaml \
--filename https://github.com/knative/serving/releases/download/{{< version >}}/monitoring.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/{{< version >}}/serving-core.yaml
3. Monitor the Knative namespaces and wait until all of the pods come up with a
`STATUS` of `Running`:
@ -62,15 +56,19 @@ service mesh.
You can install Ambassador with `kubectl`:
```
kubectl apply -f https://getambassador.io/yaml/ambassador/ambassador-knative.yaml
kubectl apply -f https://getambassador.io/yaml/ambassador/ambassador-service.yaml
kubectl apply \
--filename https://getambassador.io/yaml/ambassador/ambassador-knative.yaml \
--filename https://getambassador.io/yaml/ambassador/ambassador-service.yaml
```
Ambassador will watch for and create routes based off of Knative
`ClusterIngress` resources. These will then be accessible over the external IP
address of the Ambassador service you just created.
## Configuring DNS
Get this external IP address and save it in a variable named `AMBASSADOR_IP`
Installing Ambassador will create a Kubernetes Service with type `LoadBalancer`.
This may take some time to get an IP address assigned, during this process it
will appear as `<pending>`. You must wait for this IP address to be assigned
before DNS may be set up.
Get this external IP address with:
```
$ kubectl get svc ambassador
@ -78,7 +76,28 @@ $ kubectl get svc ambassador
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ambassador LoadBalancer 10.59.246.30 35.229.120.99 80:32073/TCP 13m
$ AMBASSADOR_IP=35.229.120.99
```
This external IP can be used with your DNS provider with a wildcard `A` record;
however, for a basic functioning DNS setup (not suitable for production!) this
external IP address can be added to the `config-domain` ConfigMap in
`knative-serving`. You can edit this with the following command:
```
kubectl edit cm config-domain --namespace knative-serving
```
Given the external IP above, change the content to:
```
apiVersion: v1
kind: ConfigMap
metadata:
name: config-domain
namespace: knative-serving
data:
# xip.io is a "magic" DNS provider, which resolves all DNS lookups for:
# *.{ip}.xip.io to {ip}.
35.229.120.99.xip.io: ""
```
## Deploying an Application
@ -116,22 +135,20 @@ route traffic to a serverless application.
`Knative Service`s are exposed via a `Host` header assigned by Knative. By
default, Knative will assign the `Host`:
`{service-name}.{namespace}.example.com`. You can verify this by checking the
`EXTERNAL-IP` of the `helloworld-go` service created above.
`{service-name}.{namespace}.{the domain we setup above}`. You can see this
with:
```
$ kubectl get service helloworld-go
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
helloworld-go ExternalName <none> helloworld-go.default.example.com <none> 32m
$ kubectl get ksvc helloworld-go
NAME URL LATESTCREATED LATESTREADY READY REASON
helloworld-go http://helloworld-go.default.34.83.124.52.xip.io helloworld-go-nwblj helloworld-go-nwblj True
```
Ambassador will use this `Host` header to route requests to the correct
service. You can send a request to the `helloworld-go` service with curl
using the `Host` and `AMBASSADOR_IP` from above:
You can send a request to the `helloworld-go` service with curl
using the `URL` given above:
```
$ curl -H "Host: helloworld-go.default.example.com" $AMBASSADOR_IP
$ curl http://helloworld-go.default.34.83.124.52.xip.io
Hello Go Sample v1!
```