Every Knative Service receives a DNS name in the format {service-name}.{namespace}.{domain-suffix}. The default domain suffix is example.com -- a service named helloworld-go in the default namespace resolves to helloworld-go.default.example.com. To use a domain that reflects your organization, replace the default suffix in the Service Mesh (ASM) console. Knative automatically updates all existing Services and Routes to use the new domain.
Prerequisites
Before you begin, make sure that you have:
Access to the ASM console
Change the default domain suffix
Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.
On the Mesh Management page, click the name of your ASM instance. In the left-side navigation pane, choose Ecosystem > Knative on ASM.
In the Knative components section of the Knative on ASM page, click edit to the right of Service domain name suffix.
Enter your custom domain -- for example,
aliyun.com-- and then click confirm edit.
Verify the custom domain
After the domain suffix changes, Knative automatically updates all Knative Services and Routes based on the ConfigMap. Each Knative Service receives a new hostname. For example, the helloworld-go service in the default namespace with the domain set to aliyun.com becomes helloworld-go.default.aliyun.com.
Test locally with the hosts file
Add an entry to your local hosts file that maps the new hostname to your ASM gateway IP address. Replace <gateway-ip> with the actual IP address. To find the gateway address, see Query the gateway address.
<gateway-ip> helloworld-go.default.aliyun.comSend a request with curl:
curl http://helloworld-go.default.aliyun.comExpected output:
Hello Knative!You can also open https://helloworld-go.default.aliyun.com in a browser.
What's next
Access a Knative Service over HTTPS through an ASM gateway -- Secure your custom domain with TLS certificates.
Perform a canary release based on traffic splitting -- Distribute traffic across Revisions for gradual rollouts.
Enable autoscaling based on request count -- Automatically scale pods based on concurrent request metrics.