mirror of https://github.com/knative/docs.git
Format markdown (#650)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
This commit is contained in:
parent
8184d7a72e
commit
4f0ffb8d31
|
@ -25,8 +25,7 @@ The scope varies depending on your platform:
|
||||||
- For IBM Cloud Kubernetes Service use
|
- For IBM Cloud Kubernetes Service use
|
||||||
`172.30.0.0/16,172.20.0.0/16,10.10.10.0/24`
|
`172.30.0.0/16,172.20.0.0/16,10.10.10.0/24`
|
||||||
- For Azure Container Service (ACS) use `10.244.0.0/16,10.240.0.0/16`
|
- For Azure Container Service (ACS) use `10.244.0.0/16,10.240.0.0/16`
|
||||||
- For Pivotal Container Service (PKS) on GCP use
|
- For Pivotal Container Service (PKS) on GCP use `10.200.0.0/16,10.100.200.0/24`
|
||||||
`10.200.0.0/16,10.100.200.0/24`
|
|
||||||
- For Minikube use `10.0.0.1/24`
|
- For Minikube use `10.0.0.1/24`
|
||||||
|
|
||||||
## Setting the IP scope
|
## Setting the IP scope
|
||||||
|
|
|
@ -21,7 +21,6 @@ A demonstration of the autoscaling capabilities of a Knative Serving Revision.
|
||||||
|
|
||||||
## Deploy the Service
|
## Deploy the Service
|
||||||
|
|
||||||
|
|
||||||
1. Deploy the [sample](./service.yaml) Knative Service:
|
1. Deploy the [sample](./service.yaml) Knative Service:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -10,6 +10,7 @@ publishing the Knative domain.
|
||||||
## Set up environtment variables
|
## Set up environtment variables
|
||||||
|
|
||||||
Run the following command to configure the environment variables
|
Run the following command to configure the environment variables
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export PROJECT_NAME=<your-google-cloud-project-name>
|
export PROJECT_NAME=<your-google-cloud-project-name>
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ read/write permissions.
|
||||||
|
|
||||||
You can create a GKE cluster with Cloud DNS scope by entering the following
|
You can create a GKE cluster with Cloud DNS scope by entering the following
|
||||||
command:
|
command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gcloud container clusters create $CLUSTER_NAME \
|
gcloud container clusters create $CLUSTER_NAME \
|
||||||
--zone=$CLUSTER_ZONE \
|
--zone=$CLUSTER_ZONE \
|
||||||
|
@ -39,11 +41,15 @@ gcloud container clusters create $CLUSTER_NAME \
|
||||||
--scopes=service-control,service-management,compute-rw,storage-ro,cloud-platform,logging-write,monitoring-write,pubsub,datastore,"https://www.googleapis.com/auth/ndev.clouddns.readwrite" \
|
--scopes=service-control,service-management,compute-rw,storage-ro,cloud-platform,logging-write,monitoring-write,pubsub,datastore,"https://www.googleapis.com/auth/ndev.clouddns.readwrite" \
|
||||||
--num-nodes=3
|
--num-nodes=3
|
||||||
```
|
```
|
||||||
Note that by using this way, any pod within the cluster will have permissions to read/write CloudDNS.
|
|
||||||
|
Note that by using this way, any pod within the cluster will have permissions to
|
||||||
|
read/write CloudDNS.
|
||||||
|
|
||||||
### Cluster with Cloud DNS Admin Service Account credential
|
### Cluster with Cloud DNS Admin Service Account credential
|
||||||
|
|
||||||
1. Create a GKE cluster without Cloud DNS scope by entering the following command:
|
1. Create a GKE cluster without Cloud DNS scope by entering the following
|
||||||
|
command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gcloud container clusters create $CLUSTER_NAME \
|
gcloud container clusters create $CLUSTER_NAME \
|
||||||
--zone=$CLUSTER_ZONE \
|
--zone=$CLUSTER_ZONE \
|
||||||
|
@ -56,6 +62,7 @@ gcloud container clusters create $CLUSTER_NAME \
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Create a new service account for Cloud DNS admin role.
|
2. Create a new service account for Cloud DNS admin role.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Name of the service account you want to create.
|
# Name of the service account you want to create.
|
||||||
export CLOUD_DNS_SA=cloud-dns-admin
|
export CLOUD_DNS_SA=cloud-dns-admin
|
||||||
|
@ -66,6 +73,7 @@ gcloud --project $PROJECT_NAME iam service-accounts \
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Bind the role `dns.admin` to the newly created service account.
|
3. Bind the role `dns.admin` to the newly created service account.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Fully-qualified service account name also has project-id information.
|
# Fully-qualified service account name also has project-id information.
|
||||||
export CLOUD_DNS_SA=$CLOUD_DNS_SA@$PROJECT_NAME.iam.gserviceaccount.com
|
export CLOUD_DNS_SA=$CLOUD_DNS_SA@$PROJECT_NAME.iam.gserviceaccount.com
|
||||||
|
@ -76,38 +84,45 @@ gcloud projects add-iam-policy-binding $PROJECT_NAME \
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Download the secret key file for your service account.
|
4. Download the secret key file for your service account.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gcloud iam service-accounts keys create ~/key.json \
|
gcloud iam service-accounts keys create ~/key.json \
|
||||||
--iam-account=$CLOUD_DNS_SA
|
--iam-account=$CLOUD_DNS_SA
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Upload the service account credential to your cluster.
|
5. Upload the service account credential to your cluster. This command uses the
|
||||||
This command uses the secret name `cloud-dns-key`, but you can
|
secret name `cloud-dns-key`, but you can choose a different name.
|
||||||
choose a different name.
|
|
||||||
```shell
|
```shell
|
||||||
kubectl create secret generic cloud-dns-key \
|
kubectl create secret generic cloud-dns-key \
|
||||||
--from-file=key.json=$HOME/key.json
|
--from-file=key.json=$HOME/key.json
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Delete the local secret
|
6. Delete the local secret
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
rm ~/key.json
|
rm ~/key.json
|
||||||
```
|
```
|
||||||
|
|
||||||
Now your cluster has the credential of your CloudDNS admin service account.
|
Now your cluster has the credential of your CloudDNS admin service account. And
|
||||||
And it can be used to access your Cloud DNS. You can enforce the access of the
|
it can be used to access your Cloud DNS. You can enforce the access of the
|
||||||
credentail secret within your cluster, so that only the pods that have the
|
credentail secret within your cluster, so that only the pods that have the
|
||||||
permission to get the credential secret can access your Cloud DNS.
|
permission to get the credential secret can access your Cloud DNS.
|
||||||
|
|
||||||
## Set up Knative
|
## Set up Knative
|
||||||
|
|
||||||
1. Follow the [instruction](https://github.com/knative/docs/blob/master/install/README.md) to install Knative on your cluster.
|
1. Follow the
|
||||||
|
[instruction](https://github.com/knative/docs/blob/master/install/README.md)
|
||||||
|
to install Knative on your cluster.
|
||||||
1. Configure Knative to use your custom domain.
|
1. Configure Knative to use your custom domain.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl edit cm config-domain --namespace knative-serving
|
kubectl edit cm config-domain --namespace knative-serving
|
||||||
```
|
```
|
||||||
|
|
||||||
This command opens your default text editor and allows you to edit the config
|
This command opens your default text editor and allows you to edit the config
|
||||||
map.
|
map.
|
||||||
|
|
||||||
```
|
```
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
@ -115,9 +130,11 @@ data:
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
[...]
|
[...]
|
||||||
```
|
```
|
||||||
Edit the file to replace `example.com` with your custom domain (the
|
|
||||||
value of `$CUSTOM_DOMAIN`) and save your changes. In this example, we use domain `external-dns-test.my-org.do`
|
Edit the file to replace `example.com` with your custom domain (the value of
|
||||||
for all routes:
|
`$CUSTOM_DOMAIN`) and save your changes. In this example, we use domain
|
||||||
|
`external-dns-test.my-org.do` for all routes:
|
||||||
|
|
||||||
```
|
```
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
@ -141,6 +158,7 @@ A DNS zone which will contain the managed DNS records needs to be created.
|
||||||
|
|
||||||
Use the following command to create a DNS zone with
|
Use the following command to create a DNS zone with
|
||||||
[Google Cloud DNS](https://cloud.google.com/dns/):
|
[Google Cloud DNS](https://cloud.google.com/dns/):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export DNS_ZONE_NAME=<dns-zone-name>
|
export DNS_ZONE_NAME=<dns-zone-name>
|
||||||
|
|
||||||
|
@ -148,27 +166,33 @@ gcloud dns managed-zones create $DNS_ZONE_NAME \
|
||||||
--dns-name $CUSTOM_DOMAIN \
|
--dns-name $CUSTOM_DOMAIN \
|
||||||
--description "Automatically managed zone by kubernetes.io/external-dns"
|
--description "Automatically managed zone by kubernetes.io/external-dns"
|
||||||
```
|
```
|
||||||
|
|
||||||
Make a note of the nameservers that were assigned to your new zone.
|
Make a note of the nameservers that were assigned to your new zone.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gcloud dns record-sets list \
|
gcloud dns record-sets list \
|
||||||
--zone $DNS_ZONE_NAME \
|
--zone $DNS_ZONE_NAME \
|
||||||
--name $CUSTOM_DOMAIN \
|
--name $CUSTOM_DOMAIN \
|
||||||
--type NS
|
--type NS
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see output similar to the following assuming your custom domain is
|
You should see output similar to the following assuming your custom domain is
|
||||||
`external-dns-test.my-org.do`:
|
`external-dns-test.my-org.do`:
|
||||||
|
|
||||||
```
|
```
|
||||||
NAME TYPE TTL DATA
|
NAME TYPE TTL DATA
|
||||||
external-dns-test.my-org.do. NS 21600 ns-cloud-e1.googledomains.com.,ns-cloud-e2.googledomains.com.,ns-cloud-e3.googledomains.com.,ns-cloud-e4.googledomains.com.
|
external-dns-test.my-org.do. NS 21600 ns-cloud-e1.googledomains.com.,ns-cloud-e2.googledomains.com.,ns-cloud-e3.googledomains.com.,ns-cloud-e4.googledomains.com.
|
||||||
```
|
```
|
||||||
|
|
||||||
In this case, the DNS nameservers are `ns-cloud-{e1-e4}.googledomains.com`.
|
In this case, the DNS nameservers are `ns-cloud-{e1-e4}.googledomains.com`.
|
||||||
Yours could differ slightly, e.g. {a1-a4}, {b1-b4} etc.
|
Yours could differ slightly, e.g. {a1-a4}, {b1-b4} etc.
|
||||||
|
|
||||||
If this zone has the parent zone, you need to add NS records of this zone into
|
If this zone has the parent zone, you need to add NS records of this zone into
|
||||||
the parent zone so that this zone can be found from the parent. Assuming the
|
the parent zone so that this zone can be found from the parent. Assuming the
|
||||||
parent zone is `my-org-do` and the parent domain is `my-org.do`, and the
|
parent zone is `my-org-do` and the parent domain is `my-org.do`, and the parent
|
||||||
parent zone is also hosted at Google Cloud DNS, you can follow these steps to
|
zone is also hosted at Google Cloud DNS, you can follow these steps to add the
|
||||||
add the NS records of this zone into the parent zone:
|
NS records of this zone into the parent zone:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gcloud dns record-sets transaction start --zone "my-org-do"
|
gcloud dns record-sets transaction start --zone "my-org-do"
|
||||||
gcloud dns record-sets transaction add ns-cloud-e{1..4}.googledomains.com. \
|
gcloud dns record-sets transaction add ns-cloud-e{1..4}.googledomains.com. \
|
||||||
|
@ -180,7 +204,9 @@ gcloud dns record-sets transaction execute --zone "my-org-do"
|
||||||
|
|
||||||
Firstly, choose the manifest of ExternalDNS.
|
Firstly, choose the manifest of ExternalDNS.
|
||||||
|
|
||||||
Use below manifest if you set up your cluster with [CloudDNS scope](#cluster-with-cloud-dns-scope).
|
Use below manifest if you set up your cluster with
|
||||||
|
[CloudDNS scope](#cluster-with-cloud-dns-scope).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
|
@ -244,7 +270,9 @@ spec:
|
||||||
- --txt-owner-id=my-identifier
|
- --txt-owner-id=my-identifier
|
||||||
```
|
```
|
||||||
|
|
||||||
Or use below manifest if you set up your cluster with [CloudDNS service account credential](#cluster-with-cloud-dns-admin-service-account-credential).
|
Or use below manifest if you set up your cluster with
|
||||||
|
[CloudDNS service account credential](#cluster-with-cloud-dns-admin-service-account-credential).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
|
@ -320,6 +348,7 @@ spec:
|
||||||
|
|
||||||
Then use the following command to apply the manifest you chose to install
|
Then use the following command to apply the manifest you chose to install
|
||||||
ExternalDNS
|
ExternalDNS
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cat <<EOF | kubectl apply --filename -
|
cat <<EOF | kubectl apply --filename -
|
||||||
<your-chosen-manifest>
|
<your-chosen-manifest>
|
||||||
|
@ -327,6 +356,7 @@ EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see ExternalDNS is installed by running:
|
You should see ExternalDNS is installed by running:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get deployment external-dns
|
kubectl get deployment external-dns
|
||||||
```
|
```
|
||||||
|
@ -334,15 +364,18 @@ kubectl get deployment external-dns
|
||||||
### Configuring Knative Gateway service
|
### Configuring Knative Gateway service
|
||||||
|
|
||||||
In order to publish the Knative Gateway service, the annotation
|
In order to publish the Knative Gateway service, the annotation
|
||||||
`external-dns.alpha.kubernetes.io/hostname: '*.$CUSTOM_DOMAIN`
|
`external-dns.alpha.kubernetes.io/hostname: '*.$CUSTOM_DOMAIN` needs to be added
|
||||||
needs to be added into Knative gateway service:
|
into Knative gateway service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl edit svc knative-ingressgateway --namespace istio-system
|
kubectl edit svc knative-ingressgateway --namespace istio-system
|
||||||
```
|
```
|
||||||
This command opens your default text editor and allows you to add the
|
|
||||||
annotation to `knative-ingressgateway` service. After you've added your
|
This command opens your default text editor and allows you to add the annotation
|
||||||
annotation, your file may look similar to this (assuming your custom domain is
|
to `knative-ingressgateway` service. After you've added your annotation, your
|
||||||
|
file may look similar to this (assuming your custom domain is
|
||||||
`external-dns-test.my-org.do`):
|
`external-dns-test.my-org.do`):
|
||||||
|
|
||||||
```
|
```
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
@ -360,6 +393,7 @@ service was created.
|
||||||
```shell
|
```shell
|
||||||
gcloud dns record-sets list --zone $DNS_ZONE_NAME --name "*.$CUSTOM_DOMAIN."
|
gcloud dns record-sets list --zone $DNS_ZONE_NAME --name "*.$CUSTOM_DOMAIN."
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see output similar to:
|
You should see output similar to:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -372,12 +406,16 @@ NAME TYPE TTL DATA
|
||||||
|
|
||||||
You can check if the domain has been published to the Internet be entering the
|
You can check if the domain has been published to the Internet be entering the
|
||||||
following command:
|
following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
host test.external-dns-test.my-org.do
|
host test.external-dns-test.my-org.do
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see the below result after the domain is published:
|
You should see the below result after the domain is published:
|
||||||
|
|
||||||
```
|
```
|
||||||
test.external-dns-test.my-org.do has address 35.231.248.30
|
test.external-dns-test.my-org.do has address 35.231.248.30
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: The process of publishing the domain to the Internet can take several
|
> Note: The process of publishing the domain to the Internet can take several
|
||||||
minutes.
|
> minutes.
|
||||||
|
|
Loading…
Reference in New Issue