Default domain name settings
The fully qualified domain name for a route by default is {route}.{namespace}.{default-domain}
. Knative Serving routes use example.com
as the default domain.
You can change the default domain by modifying the config-domain ConfigMap.
Warning
Customizing a domain using this ConfigMap affects your cluster globally. If you want to customize the domain of an individual Service, use DomainMapping instead.
Procedure
Open the
config-domain
ConfigMap in your default text editor:kubectl edit configmap config-domain -n knative-serving
Edit the file to replace
example.com
with the domain you want to use, then remove the_example
key and save your changes. In this example,mydomain.com
is configured as the domain for all routes:apiVersion: v1
data:
mydomain.com: ""
kind: ConfigMap
[...]
If you have an existing deployment, Knative reconciles the change made to the ConfigMap, and automatically updates the host name for all of the deployed Services and Routes.
Verification steps
- Deploy an app to your cluster.
Retrieve the URL for the Route:
kubectl get route <route-name> --output jsonpath="{.status.url}"
Where
<route-name>
is the name of the Route.Observe the customized domain that you have configured.
Publish your Domain
To make your domain publicly accessible, you must update your DNS provider to point to the IP address for your service ingress.
Create a wildcard record for the namespace and custom domain to the ingress IP Address, which would enable hostnames for multiple services in the same namespace to work without creating additional DNS entries.
*.default.mydomain.com 59 IN A 35.237.28.44
Create an A record to point from the fully qualified domain name to the IP address of your Knative gateway. This step needs to be done for each Knative Service or Route created.
helloworld-go.default.mydomain.com 59 IN A 35.237.28.44
After the domain update has propagated, you can access your app by using the fully qualified domain name of the deployed route.