Refactor DNS snippets (#3967)

* Refactor DNS snippets

Splits in to multiple files so that Operator can have a different version for the Real DNS section.

* fix formatting
This commit is contained in:
Julian Friedman 2021-07-07 20:14:18 +01:00 committed by GitHub
parent 15ac10336c
commit ea0a6fdd24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 101 additions and 72 deletions

View File

@ -311,7 +311,10 @@ knative-serving <version number> True
Save this for configuring DNS below.
<!-- These are snippets from the docs/snippets directory -->
{% include "dns.md" %}
{% include "real-dns-operator.md" %}
{% include "temporary-dns.md" %}
## Installing the Knative Eventing component

View File

@ -178,7 +178,10 @@ Follow the procedure for the networking layer of your choice:
kubectl get pods --namespace knative-serving
```
<!-- These are snippets from the docs/snippets directory -->
{% include "dns.md" %}
{% include "real-dns-yaml.md" %}
{% include "temporary-dns.md" %}
## Install optional Serving extensions

View File

@ -20,75 +20,3 @@ Follow the procedure for the DNS of your choice:
is running.
In these cases, see the "Real DNS" or "Temporary DNS" tabs.
=== "Real DNS"
To configure DNS for Knative, take the External IP
or CNAME from setting up networking, and configure it with your DNS provider as
follows:
- If the networking layer produced an External IP address, then configure a
wildcard `A` record for the domain:
```
# Here knative.example.com is the domain suffix for your cluster
*.knative.example.com == A 35.233.41.212
```
- If the networking layer produced a CNAME, then configure a CNAME record for the domain:
```
# Here knative.example.com is the domain suffix for your cluster
*.knative.example.com == CNAME a317a278525d111e89f272a164fd35fb-1510370581.eu-central-1.elb.amazonaws.com
```
Once your DNS provider has been configured, add the following section into your existing Serving CR, and apply it:
```yaml
# Replace knative.example.com with your domain suffix
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
config:
domain:
"knative.example.com": ""
...
```
=== "Temporary DNS"
If you are using `curl` to access the sample applications, or your own Knative app, and are unable to use the "Magic DNS (sslip.io)" or "Real DNS" methods, there is a temporary approach. This is useful for those who wish to evaluate Knative without altering their DNS configuration, as per the "Real DNS" method, or cannot use the "Magic DNS" method due to using,
for example, minikube locally or IPv6 clusters.
To access your application using `curl` using this method:
1. After starting your application, get the URL of your application:
```bash
kubectl get ksvc
```
The output should be similar to:
```bash
NAME URL LATESTCREATED LATESTREADY READY REASON
helloworld-go http://helloworld-go.default.example.com helloworld-go-vqjlf helloworld-go-vqjlf True
```
1. Instruct `curl` to connect to the External IP or CNAME defined by the
networking layer in section 3 above, and use the `-H "Host:"` command-line
option to specify the Knative application's host name.
For example, if the networking layer defines your External IP and port to be `http://192.168.39.228:32198` and you wish to access the above `helloworld-go` application, use:
```bash
curl -H "Host: helloworld-go.default.example.com" http://192.168.39.228:32198
```
In the case of the provided `helloworld-go` sample application, using the default configuration, the output is:
```
Hello Go Sample v1!
```
Refer to the "Real DNS" method for a permanent solution.

View File

@ -0,0 +1,36 @@
=== "Real DNS"
To configure DNS for Knative, take the External IP
or CNAME from setting up networking, and configure it with your DNS provider as
follows:
- If the networking layer produced an External IP address, then configure a
wildcard `A` record for the domain:
```
# Here knative.example.com is the domain suffix for your cluster
*.knative.example.com == A 35.233.41.212
```
- If the networking layer produced a CNAME, then configure a CNAME record for the domain:
```
# Here knative.example.com is the domain suffix for your cluster
*.knative.example.com == CNAME a317a278525d111e89f272a164fd35fb-1510370581.eu-central-1.elb.amazonaws.com
```
- Once your DNS provider has been configured, add the following section into your existing Serving CR, and apply it:
```yaml
# Replace knative.example.com with your domain suffix
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
config:
domain:
"knative.example.com": ""
...
```

View File

@ -0,0 +1,30 @@
=== "Real DNS"
To configure DNS for Knative, take the External IP
or CNAME from setting up networking, and configure it with your DNS provider as
follows:
- If the networking layer produced an External IP address, then configure a
wildcard `A` record for the domain:
```
# Here knative.example.com is the domain suffix for your cluster
*.knative.example.com == A 35.233.41.212
```
- If the networking layer produced a CNAME, then configure a CNAME record for the domain:
```
# Here knative.example.com is the domain suffix for your cluster
*.knative.example.com == CNAME a317a278525d111e89f272a164fd35fb-1510370581.eu-central-1.elb.amazonaws.com
```
- Once your DNS provider has been configured, direct Knative to use that domain:
```yaml
# Replace knative.example.com with your domain suffix
kubectl patch configmap/config-domain \
--namespace knative-serving \
--type merge \
--patch '{"data":{"knative.example.com":""}}'
```

View File

@ -0,0 +1,29 @@
=== "Temporary DNS"
If you are using `curl` to access the sample applications, or your own Knative app, and are unable to use the "Magic DNS (sslip.io)" or "Real DNS" methods, there is a temporary approach. This is useful for those who wish to evaluate Knative without altering their DNS configuration, as per the "Real DNS" method, or cannot use the "Magic DNS" method due to using,
for example, minikube locally or IPv6 clusters.
To access your application using `curl` using this method:
1. After starting your application, get the URL of your application:
```bash
kubectl get ksvc
```
The output should be similar to:
```bash
NAME URL LATESTCREATED LATESTREADY READY REASON
helloworld-go http://helloworld-go.default.example.com helloworld-go-vqjlf helloworld-go-vqjlf True
```
1. Instruct `curl` to connect to the External IP or CNAME defined by the
networking layer in section 3 above, and use the `-H "Host:"` command-line
option to specify the Knative application's host name.
For example, if the networking layer defines your External IP and port to be `http://192.168.39.228:32198` and you wish to access the above `helloworld-go` application, use:
```bash
curl -H "Host: helloworld-go.default.example.com" http://192.168.39.228:32198
```
In the case of the provided `helloworld-go` sample application, using the default configuration, the output is:
```
Hello Go Sample v1!
```
Refer to the "Real DNS" method for a permanent solution.