|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * serverless/knative_serving/serverless-custom-domains.adoc |
| 4 | + |
| 5 | +[id="serverless-domain-mapping-odc-admin_{context}"] |
| 6 | += Mapping a custom domain to a service by using the Administrator perspective |
| 7 | + |
| 8 | +If you have cluster administrator permissions, you can create a `DomainMapping` custom resource (CR) by using the *Administrator* perspective in the {product-title} web console. |
| 9 | + |
| 10 | +.Prerequisites |
| 11 | + |
| 12 | +* You have logged in to the web console. |
| 13 | +* You are in the *Administrator* perspective. |
| 14 | +* You have installed the {ServerlessOperatorName}. |
| 15 | +* You have installed Knative Serving. |
| 16 | +* You have created a project or have access to a project with the appropriate roles and permissions to create applications and other workloads in {product-title}. |
| 17 | +* You have created a Knative service and control a custom domain that you want to map to that service. |
| 18 | ++ |
| 19 | +[NOTE] |
| 20 | +==== |
| 21 | +Your custom domain must point to the IP address of the {product-title} cluster. |
| 22 | +==== |
| 23 | + |
| 24 | +.Procedure |
| 25 | + |
| 26 | +. Navigate to *CustomResourceDefinitions* and use the search box to find the *DomainMapping* custom resource definition (CRD). |
| 27 | + |
| 28 | +. Click the *DomainMapping* CRD, then navigate to the *Instances* tab. |
| 29 | + |
| 30 | +. Click *Create DomainMapping*. |
| 31 | + |
| 32 | +. Modify the YAML for the `DomainMapping` CR so that it includes the following information for your instance: |
| 33 | ++ |
| 34 | +[source,yaml] |
| 35 | +---- |
| 36 | +apiVersion: serving.knative.dev/v1alpha1 |
| 37 | +kind: DomainMapping |
| 38 | +metadata: |
| 39 | + name: <domain_name> <1> |
| 40 | + namespace: <namespace> <2> |
| 41 | +spec: |
| 42 | + ref: |
| 43 | + name: <target_name> <3> |
| 44 | + kind: <target_type> <4> |
| 45 | + apiVersion: serving.knative.dev/v1 |
| 46 | +---- |
| 47 | +<1> The custom domain name that you want to map to the target CR. |
| 48 | +<2> The namespace of both the `DomainMapping` CR and the target CR. |
| 49 | +<3> The name of the target CR to map to the custom domain. |
| 50 | +<4> The type of CR being mapped to the custom domain. |
| 51 | ++ |
| 52 | +.Example domain mapping to a Knative service |
| 53 | +[source,yaml] |
| 54 | +---- |
| 55 | +apiVersion: serving.knative.dev/v1alpha1 |
| 56 | +kind: DomainMapping |
| 57 | +metadata: |
| 58 | + name: custom-ksvc-domain.example.com |
| 59 | + namespace: default |
| 60 | +spec: |
| 61 | + ref: |
| 62 | + name: example-service |
| 63 | + kind: Service |
| 64 | + apiVersion: serving.knative.dev/v1 |
| 65 | +---- |
| 66 | + |
| 67 | +.Verification |
| 68 | + |
| 69 | +* Access the custom domain by using a `curl` request. For example: |
| 70 | ++ |
| 71 | +.Example command |
| 72 | +[source,terminal] |
| 73 | +---- |
| 74 | +$ curl custom-ksvc-domain.example.com |
| 75 | +---- |
| 76 | ++ |
| 77 | +.Example output |
| 78 | +[source,terminal] |
| 79 | +---- |
| 80 | +Hello OpenShift! |
| 81 | +---- |
0 commit comments