$ kn domain create <domain_mapping_name> --ref <target_name>
You can use the following commands to create and manage domain mappings.
The OpenShift Serverless Operator and Knative Serving are installed on your cluster.
You have created a Knative service or route, and control a custom domain that you want to map to that CR.
Your custom domain must point to the DNS of the OpenShift Container Platform cluster. |
You have installed the Knative (kn
) cli.
You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
Map a domain to a CR in the current namespace:
$ kn domain create <domain_mapping_name> --ref <target_name>
$ kn domain create example.com --ref showcase
The --ref
flag specifies an Addressable target CR for domain mapping.
If a prefix is not provided when using the --ref
flag, it is assumed that the target is a Knative service in the current namespace.
Map a domain to a Knative service in a specified namespace:
$ kn domain create <domain_mapping_name> --ref <ksvc:service_name:service_namespace>
$ kn domain create example.com --ref ksvc:showcase:example-namespace
Map a domain to a Knative route:
$ kn domain create <domain_mapping_name> --ref <kroute:route_name>
$ kn domain create example.com --ref kroute:example-route
After you have created a DomainMapping
custom resource (CR), you can list existing CRs, view information about an existing CR, update CRs, or delete CRs by using the Knative (kn
) cli.
The OpenShift Serverless Operator and Knative Serving are installed on your cluster.
You have created at least one DomainMapping
CR.
You have installed the Knative (kn
) cli tool.
You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in OpenShift Container Platform.
List existing DomainMapping
CRs:
$ kn domain list -n <domain_mapping_namespace>
View details of an existing DomainMapping
CR:
$ kn domain describe <domain_mapping_name>
Update a DomainMapping
CR to point to a new target:
$ kn domain update --ref <target>
Delete a DomainMapping
CR:
$ kn domain delete <domain_mapping_name>