Assigning a domain name
Default domain naming assigns ugly names that aren't good for user-facing applications (e.g. web sites).
To make a nice domain name like
mydomain.com go to your Knative service, you
need to register this hostname to the Knative load balancer.
However, Knative does not offer a feature to map extra domains to your
Service (see related discussion).
Use a reverse proxy and rewrite Host header: Use a load balancer or proxy to accept the traffic (and point domain DNS records to it), then rewrite your
Hostheader to be the external domain of your Knative app1. You can use Cloudflare as it can rewrite Host header (currently available only in Enterprise plan).
Duplicating Istio VirtualService entry (not recommended): (Explained here) This is not recommended as the created VirtualService won't be managed, kept up-to-date or cleaned up by Knative.
Cloud Run on GKE Domain Mappings
You can create a domain mapping through Google’s UI or CLI, then see the resulting Kubernetes custom API object:
$ kubectl get domainmapping -o=yaml
Note that these domains will not show up on
kubectl describe ksvc or
kubectl get ksvc commands, as this API directly updates the ingress gateway (by
creating an additional Istio VirtualService object that isn't managed by Knative
When the proxy/load balancer sets the
Hostheader to the value of your KService, the Knative ingress gateway knows how to the traffic to your service. ↩︎