From 08509ea419e462ece28205c9b65f0cac5a2ad23a Mon Sep 17 00:00:00 2001 From: Zhimin Xiang Date: Fri, 6 Jul 2018 13:21:58 -0700 Subject: [PATCH] Replace Ingress with Gateway in DNS.md (#64) * 1. remove Ingress with Gateway. 2. fix typos * replace the custom domain 'knative.dev' with 'knative-exampl.ecom' to avoid confusion * 1. replace knative-example.com with mydomain.com. 2. fix some weird line break * fix typo and reorder the content about how to create DNS records --- serving/DNS.md | 73 +++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/serving/DNS.md b/serving/DNS.md index 391e423ca..10db01f14 100644 --- a/serving/DNS.md +++ b/serving/DNS.md @@ -7,8 +7,8 @@ To change the {default-domain} value there are a few steps involved: ## Edit using kubectl -1. Edit the domain configuration config-map to replace `example.com` - with your own customer domain, for example `knative.dev`: +1. Edit the domain configuration config-map to replace `example.com` + with your own customer domain, for example `mydomain.com`: ```shell kubectl edit cm config-domain -n knative-serving @@ -33,13 +33,13 @@ kind: ConfigMap [...] ``` -Edit the file to replace `example.org` with the new domain you wish to use -and save your changes. In this example, we configure `knative.dev` for all routes: +Edit the file to replace `example.com` and `example.org` with the new domains +you wish to use and save your changes. In this example, we configure `mydomain.com` for all routes: ```yaml apiVersion: v1 data: - knative.dev: "" + mydomain.com: "" kind: ConfigMap [...] ``` @@ -49,7 +49,7 @@ kind: ConfigMap You can also apply an updated domain configuration config-map: 1. Create a new file, `config-domain.yaml` and paste the following text, - replacing the `prod-domain.com` and `demo-domain.com` values with the new + replacing the `example.org` and `example.com` values with the new domain you want to use: ```yaml @@ -83,27 +83,31 @@ You can also apply an updated domain configuration config-map: > services and routes. -Deploy an app to your cluster as normal. For example, if you use the -[`helloworld-go`](./samples/helloworld-go/README.md) sample app, when the -ingress is ready, you'll see customized domain in HOSTS field together with -assigned IP address: - +Deploy an app (for example, [`helloworld-go`](./samples/helloworld-go/README.md)), to your cluster as normal. You can check the customized domain in +Knative Route "helloworld-go" with ```shell -$ kubectl get ingress +kubectl get route helloworld-go -o jsonpath="{.status.domain}" +``` +You should see the full customized domain is `helloworld-go.default.mydomain.com`. -NAME HOSTS ADDRESS PORTS AGE -helloworld-go-ingress helloworld-go.default.knative.dev,*.helloworld-go.default.knative.dev 35.237.28.44 80 2m +And you can check the IP address of Knative gateway with +```shell +kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*]['ip']}" ``` ## Local DNS setup -You can map the domain to the Ingress IP address in your local machine with: + +You can map the domain to the IP address of Knative Gateway in your local +machine with: ```shell -export INGRESS_IP=`kubectl get ingress -o jsonpath="{.status.loadBalancer.ingress[*]['ip']}"` +export GATEWAY_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*]['ip']}"` -export DOMAIN_NAME= +# helloworld-go is the generated Knative Route of "helloworld-go" sample. +# You need to replace it with your own Route in your project. +export DOMAIN_NAME=`kubectl get route helloworld-go -o jsonpath="{.status.domain}"` -# Add the record of Ingress IP and domain name into file "/etc/hosts" -echo -e "$INGRESS_IP\t$DOMAIN_NAME" | sudo tee -a /etc/hosts +# Add the record of Gateway IP and domain name into file "/etc/hosts" +echo -e "$GATEWAY_IP\t$DOMAIN_NAME" | sudo tee -a /etc/hosts ``` By this way, you can access your domain from the browser in your machine and @@ -113,30 +117,31 @@ By this way, you can access your domain from the browser in your machine and Follow the below steps to make your domain publicly accessible. -### Set static IP for Ingresses -You may want to set static IP for your Ingresses so that the Ingress IP will - not be changed after restarting your cluster. -Follow the [instructions](https://github.com/knative/serving/blob/master/docs/setting-up-ingress-static-ip.md) to set static IP for Ingresses. +### Set static IP for Knative Gateway + +You may want to set static IP for your Knative Gateway so that the Gateway IP +will not be changed after restarting your cluster. +Follow the [instructions](https://github.com/knative/serving/blob/master/docs/setting-up-ingress-static-ip.md) to set static IP for Knative Gateway. ### Update your DNS records To publish your domain, you need to update your DNS provider to point to the IP address for your service ingress. -* Create an A record to point from the fully qualified domain name (shown as HOSTS in the ingress - output) to the IP address listed: - - ```dns - helloworld-go.default. 59 IN A 35.237.28.44 - ``` - * Create a [wildcard record](https://support.google.com/domains/answer/4633759) - for the namespace and custom domain to the ingress IP Address. This will - enable hostnames for multiple services in the same namespace to work without + for the namespace and custom domain to the ingress IP Address. This will enable hostnames for multiple services in the same namespace to work without creating additional DNS entries. ```dns - *.default. 59 IN A 35.237.28.44 + *.default.mydomain.com 59 IN A 35.237.28.44 + ``` + +* Create an A record to point from the fully qualified domain name to the IP +address of Knative Gateway. This needs to be done for each Knative Service or +Route created. + + ```dns + helloworld-go.default.mydomain.com 59 IN A 35.237.28.44 ``` If you are using Google Cloud DNS, you can find step-by-step instructions @@ -145,4 +150,4 @@ in the [Cloud DNS quickstart](https://cloud.google.com/dns/quickstart). Once the domain update has propagated, you can then access your app using the fully qualified domain name of the deployed route, for example -`http://helloworld-go.default.knative.dev` +`http://helloworld-go.default.mydomain.com`