Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

KNative Serving API Resources: Domainmapping

native Domain Mapping is a feature of Knative that allows you to map custom domains to Knative Services. With Domain Mapping, you can use your own domain name, such as example.com, to access a Knative Service, rather than the default domain name provided by Knative, such as example.default.example.com.

To use Domain Mapping, you need to have a custom domain name that you control, such as example.com. You can then create a Domain Mapping in Knative that maps your custom domain name to a Knative Service. Once you have created the Domain Mapping, you can access your Knative Service using your custom domain name.

Domain Mapping in Knative works by creating a Kubernetes Ingress resource that routes traffic from your custom domain name to the Knative Service. The Ingress resource uses the Istio Gateway service to route traffic to the appropriate Knative Service based on the domain name.

To create a Domain Mapping in Knative, you can use the kubectl command line tool to create a Kubernetes Ingress resource with the appropriate annotations. For example:


apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: example-domain-mapping
  annotations:
    kubernetes.io/ingress.class: istio
    networking.knative.dev/ingress.class: istio
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: my-knative-service
          servicePort: 80

In this example, the Ingress resource maps the domain name example.com to the Knative Service named my-knative-service, which is running on port 80.

Once you have created the Ingress resource, Knative will automatically create the necessary Istio Gateway and VirtualService resources to route traffic from your custom domain name to the Knative Service.

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x