mirror of https://github.com/knative/docs.git
parent
5f22aa69df
commit
87a2c626fc
|
@ -6,12 +6,12 @@ Each Knative Service is automatically assigned a default domain name when it is
|
|||
|
||||
You can create a `DomainMapping` object to map a single, non-wildcard domain to a specific Knative Service.
|
||||
|
||||
For example, if you own the domain name `example.org`, and you configure the domain DNS to reference your Knative cluster, you can use domain mapping to
|
||||
For example, if you own the domain name `example.org`, and you configure the domain DNS to reference your Knative cluster, you can use DomainMapping to
|
||||
serve a Knative Service at this domain.
|
||||
|
||||
!!! note
|
||||
If you create a domain mapping to map to a [private Knative Service](private-services.md),
|
||||
the private Knative Service will be accessible from public internet with the custom domain of the domain mapping.
|
||||
the private Knative Service is accessible from public internet with the custom domain of the domain mapping.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
@ -22,38 +22,37 @@ serve a Knative Service at this domain.
|
|||
|
||||
## Procedure
|
||||
|
||||
By default, in order to create a DomainMapping you, or a cluster
|
||||
administrator, must first delegate the domain name to the namespace you wish
|
||||
to create the DomainMapping in by creating a ClusterDomainClaim.
|
||||
ClusterDomainClaims delegate a domain name to a namespace, so that
|
||||
DomainMappings in that namespace can use the domain name.
|
||||
To create a DomainMapping, you must first have a ClusterDomainClaim. This ClusterDomainClaim
|
||||
delegates the domain name to the namespace you want to create the DomainMapping in, which enables
|
||||
DomainMappings in that namespace to use the domain name.
|
||||
|
||||
1. Create a ClusterDomainClaim:
|
||||
1. Create a ClusterDomainClaim manually or configure automatic creation of ClusterDomainClaims:
|
||||
|
||||
!!! tip
|
||||
You can avoid this step by setting the `autocreateClusterDomainClaims`
|
||||
property to "true" in the `config-network` config map, in the
|
||||
`knative-serving` namespace. This allows any user, in any namespace, to
|
||||
map any domain name, even ones in other namespaces or for domain names
|
||||
that they do not own.
|
||||
* To create a ClusterDomainClaim manually:
|
||||
|
||||
1. Create a YAML file using the following template:
|
||||
1. Create a YAML file using the following template:
|
||||
|
||||
```yaml
|
||||
apiVersion: networking.internal.knative.dev/v1alpha1
|
||||
kind: ClusterDomainClaim
|
||||
metadata:
|
||||
name: <domain-name>
|
||||
spec:
|
||||
namespace: <namespace>
|
||||
```
|
||||
```yaml
|
||||
apiVersion: networking.internal.knative.dev/v1alpha1
|
||||
kind: ClusterDomainClaim
|
||||
metadata:
|
||||
name: <domain-name>
|
||||
spec:
|
||||
namespace: <namespace>
|
||||
```
|
||||
|
||||
1. Apply the YAML file by running the command:
|
||||
1. Apply the YAML file by running the command:
|
||||
|
||||
```bash
|
||||
kubectl apply -f <filename>.yaml
|
||||
```
|
||||
Where `<filename>` is the name of the file you created in the previous step.
|
||||
```bash
|
||||
kubectl apply -f <filename>.yaml
|
||||
```
|
||||
Where `<filename>` is the name of the file you created in the previous step.
|
||||
|
||||
* To create ClusterDomainClaims automatically, set the `autocreateClusterDomainClaims` property
|
||||
to `true` in the `config-network` ConfigMap in the `knative-serving` namespace.
|
||||
This allows any user, in any namespace, to map any domain name, including ones in other
|
||||
namespaces or for domain names that they do not own.
|
||||
<!-- insert example snippet -->
|
||||
|
||||
1. Create a DomainMapping object:
|
||||
|
||||
|
@ -72,13 +71,13 @@ DomainMappings in that namespace can use the domain name.
|
|||
apiVersion: serving.knative.dev/v1
|
||||
```
|
||||
Where:
|
||||
|
||||
- `<domain-name>` is the domain name that you want to map a Service to.
|
||||
- `<namespace>` is the namespace that contains both the `DomainMapping` and `Service` objects.
|
||||
- `<service-name>` is the name of the service that will be mapped to the domain.
|
||||
- `<service-name>` is the name of the Service that is mapped to the domain.
|
||||
|
||||
!!! tip
|
||||
You can also map to other targets as long as they conform to the Addressable contract and their resolved URL is of the form `{name}.{namespace}.{clusterdomain}`, where `{name}` and `{namespace}` are the name and namespace of a Kubernetes service, and `{clusterdomain}`is the cluster domain. Examples of objects that conform to this contract include Knative Services, Routes, and Kubernetes services.
|
||||
You can also map to other targets as long as they conform to the Addressable contract and their resolved URL is of the form `<name>.<namespace>.<clusterdomain>`, where `<name>` and `<namespace>` are the name and namespace of a Kubernetes Service, and `<clusterdomain>`is the cluster domain.
|
||||
Examples of objects that conform to this contract include Knative Services, Routes, and Kubernetes Services.
|
||||
|
||||
1. Apply the YAML file by running the command:
|
||||
|
||||
|
@ -87,4 +86,5 @@ DomainMappings in that namespace can use the domain name.
|
|||
```
|
||||
Where `<filename>` is the name of the file you created in the previous step.
|
||||
|
||||
1. Point the domain name to the IP address of your Knative cluster. Details of this step differ depending on your domain registrar.
|
||||
1. Point the domain name to the IP address of your Knative cluster. Details of this step differ
|
||||
depending on your domain registrar.
|
||||
|
|
Loading…
Reference in New Issue