mirror of https://github.com/knative/docs.git
Fix formatting and a few tweaks (#4232)
This commit is contained in:
parent
a601b8ccce
commit
aa04a5b5ae
|
@ -48,62 +48,74 @@ DomainMappings in that namespace to use the domain name.
|
||||||
```
|
```
|
||||||
Where `<filename>` is the name of the file you created in the previous step.
|
Where `<filename>` is the name of the file you created in the previous step.
|
||||||
|
|
||||||
* To create ClusterDomainClaims automatically, set the `autocreateClusterDomainClaims` property
|
* To create ClusterDomainClaims automatically: set the `autocreateClusterDomainClaims` property
|
||||||
to `true` in the `config-network` ConfigMap in the `knative-serving` namespace.
|
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
|
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.
|
namespaces or for domain names that they do not own.
|
||||||
<!-- insert example snippet -->
|
<!-- insert example snippet -->
|
||||||
|
|
||||||
=== "Apply YAML"
|
|
||||||
|
|
||||||
1. Create a DomainMapping object:
|
1. Create a DomainMapping object:
|
||||||
|
|
||||||
1. Create a YAML file using the following template:
|
=== "YAML"
|
||||||
|
|
||||||
```yaml
|
1. Create a YAML file using the following template:
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
|
||||||
kind: DomainMapping
|
|
||||||
metadata:
|
|
||||||
name: <domain-name>
|
|
||||||
namespace: <namespace>
|
|
||||||
spec:
|
|
||||||
ref:
|
|
||||||
name: <service-name>
|
|
||||||
kind: Service
|
|
||||||
apiVersion: serving.knative.dev/v1
|
|
||||||
tls:
|
|
||||||
secret: <cert-secret>
|
|
||||||
```
|
|
||||||
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 is mapped to the domain.
|
|
||||||
- `<cert-secret>` is the name of a Secret that holds the server certificate for TLS communication. If this optional `tls:` section is provided, the protocol is switched from HTTP to HTTPS.
|
|
||||||
|
|
||||||
!!! tip
|
```yaml
|
||||||
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.
|
apiVersion: serving.knative.dev/v1alpha1
|
||||||
Examples of objects that conform to this contract include Knative Services, Routes, and Kubernetes Services.
|
kind: DomainMapping
|
||||||
|
metadata:
|
||||||
|
name: <domain-name>
|
||||||
|
namespace: <namespace>
|
||||||
|
spec:
|
||||||
|
ref:
|
||||||
|
name: <service-name>
|
||||||
|
kind: Service
|
||||||
|
apiVersion: serving.knative.dev/v1
|
||||||
|
tls:
|
||||||
|
secret: <cert-secret>
|
||||||
|
```
|
||||||
|
Where:
|
||||||
|
|
||||||
1. Apply the YAML file by running the command:
|
- `<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 is mapped to the domain.
|
||||||
|
- `<cert-secret>` is the name of a Secret that holds the server certificate for TLS communication. If this optional `tls:` section is provided, the protocol is switched from HTTP to HTTPS.
|
||||||
|
|
||||||
|
!!! 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
=== "kn"
|
||||||
|
Run the command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl apply -f <filename>.yaml
|
kn domain create <domain-name> --ref <target> --tls <tls-secret> --namespace <namespace>
|
||||||
```
|
```
|
||||||
Where `<filename>` is the name of the file you created in the previous step.
|
|
||||||
|
|
||||||
=== "kn CLI"
|
Where:
|
||||||
|
|
||||||
```
|
- `<domain-name>` is the domain name that you want to map a Service or Route to.
|
||||||
kn domain create <domain-name> --ref <target> --tls <tls-secret> --namespace <namespace>
|
- `<target>` is the name of the Service or Route that is mapped to the domain.
|
||||||
```
|
You can use the prefix `ksvc:` or `kroute:` to specify whether to map the domain to a Knative Service or Route.
|
||||||
|
If no prefix is given, `ksvc:` is assumed.
|
||||||
|
Additionally, you can use a `:namespace` suffix to point to a Service or Route in a different namespace.
|
||||||
|
Examples:
|
||||||
|
- `mysvc` maps to a Service `mysvc` in the same namespace as this mapping.
|
||||||
|
- `kroute:myroute:othernamespace` maps to a Route `myroute` in namespace `othernamespace`.
|
||||||
|
- `<tls-secret>` is optional and if provided enables the TLS protocol. The value specifies the secret that holds the server certificate.
|
||||||
|
- `<namespace>` is the namespace where you want to create the DomainMapping. By default the DomainMapping is created in the current namespace.
|
||||||
|
|
||||||
Where:
|
!!! note
|
||||||
- `<domain-name>` is the domain name that you want to map a Service or Route to.
|
In addition to creating DomainMappings, you can use the `kn domain`
|
||||||
- `<target>` is the name of the Service or Route that is mapped to the domain. You can use a prefix `ksvc:` or `kroute:` to specify whether to map the domain to a Knative Service or Route. If no prefix is given, `ksvc:` is assumed. Additionally, you can use a `:namespace` suffix to point to a Service or Route in a different namespace than this Domain mapping. E.g. `mysvc` maps to a Service `mysvc` in the same namespace as this mapping, while `kroute:myroute:othernamespace` maps to a Route `myroute` in namespace `othernamespace`.
|
command to list, describe, update, and delete existing DomainMappings.
|
||||||
- `<tls-secret>` is optional and if provided enables the TLS protocol. The value specifies the secret that holds the server certificate.
|
For more information about the command, run `kn domain --help`.
|
||||||
- `<namespace>` is the namespace where the DomainMapping should be created. By default the DomainMapping is created in the current namespace.
|
|
||||||
|
|
||||||
In addition to creating DomainMappings, `kn domain` can be used to list, describe, update and delete existing DomainMappings. See `kn domain --help` for more information.
|
|
||||||
|
|
||||||
1. Point the domain name to the IP address of your Knative cluster. Details of this step differ
|
1. Point the domain name to the IP address of your Knative cluster. Details of this step differ
|
||||||
depending on your domain registrar.
|
depending on your domain registrar.
|
||||||
|
|
Loading…
Reference in New Issue