1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/serverless-domain-mapping-odc-admin.adoc
2023-10-30 10:13:25 -04:00

91 lines
2.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * serverless/knative_serving/serverless-custom-domains.adoc
:_mod-docs-content-type: PROCEDURE
[id="serverless-domain-mapping-odc-admin_{context}"]
= Mapping a custom domain to a service by using the Administrator perspective
include::snippets/serverless-domain-mapping.adoc[]
ifdef::openshift-enterprise[]
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.
endif::[]
ifdef::openshift-dedicated,openshift-rosa[]
If you have cluster or dedicated administrator permissions, you can create a `DomainMapping` custom resource (CR) by using the *Administrator* perspective in the {product-title} web console.
endif::[]
.Prerequisites
* You have logged in to the web console.
* You are in the *Administrator* perspective.
* You have installed the {ServerlessOperatorName}.
* You have installed Knative Serving.
* 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}.
* You have created a Knative service and control a custom domain that you want to map to that service.
+
[NOTE]
====
Your custom domain must point to the IP address of the {product-title} cluster.
====
.Procedure
. Navigate to *CustomResourceDefinitions* and use the search box to find the *DomainMapping* custom resource definition (CRD).
. Click the *DomainMapping* CRD, then navigate to the *Instances* tab.
. Click *Create DomainMapping*.
. Modify the YAML for the `DomainMapping` CR so that it includes the following information for your instance:
+
[source,yaml]
----
apiVersion: serving.knative.dev/v1alpha1
kind: DomainMapping
metadata:
name: <domain_name> <1>
namespace: <namespace> <2>
spec:
ref:
name: <target_name> <3>
kind: <target_type> <4>
apiVersion: serving.knative.dev/v1
----
<1> The custom domain name that you want to map to the target CR.
<2> The namespace of both the `DomainMapping` CR and the target CR.
<3> The name of the target CR to map to the custom domain.
<4> The type of CR being mapped to the custom domain.
+
.Example domain mapping to a Knative service
[source,yaml]
----
apiVersion: serving.knative.dev/v1alpha1
kind: DomainMapping
metadata:
name: custom-ksvc-domain.example.com
namespace: default
spec:
ref:
name: example-service
kind: Service
apiVersion: serving.knative.dev/v1
----
.Verification
* Access the custom domain by using a `curl` request. For example:
+
.Example command
[source,terminal]
----
$ curl custom-ksvc-domain.example.com
----
+
.Example output
[source,terminal]
----
Hello OpenShift!
----