Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Knative practice: how to configure custom domain names and routing rules in Knative

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Cdn.com/81f77a803050c4e49cad74e6e5557206e07447e2.png ">

Author | Senior Development engineer of Yuanyi Aliyun Intelligent Business Group

Currently, domain name-based forwarding is supported by default in Knative. Suffixes can be configured through the domain name template, but the full domain name setting cannot be specified for users. Another problem is based on the forwarding ability of Path and Header. In many cases, we use the same domain name, and different services are distinguished by access paths.

To solve these two problems, we provide this capability in Aliyun Knative. Users can configure custom domain names through the console and set routing and forwarding settings based on Path and Header. As shown in the figure:

Custom domain name

Log in to Ali Cloud CCS console, go to * * Knative * *-> * * component Management * *, and click * * details * * on Serving component.

After entering the details, select the domain name configuration and add a custom domain name: [test.serverless.kuberun.com]. Click [OK] to save.

Configure route forwarding

Go to the [Knative]-"Service Management" console, and select the corresponding service. Here we set up different Path for access to the Login-Service service and the Search-Service service.

Login-Service service route forwarding configuration

Select the Login-Service service, select the "Route forwarding" tab, click "configure", select the "test.serverless.kuberun.com" domain name, and configure the path: / login. Click [OK] to save.

Next, continue to configure the Search-Service service routing rules.

Search-Service service route forwarding configuration

Select the Search-Service service, select the "Route forwarding" tab, click "configure", select the "test.serverless.kuberun.com" domain name, and configure the path: / search. Click [OK] to save.

Service access

After the route forwarding configuration is complete, let's test the service access:

Enter: http://test.serverless.kuberun.com/login in the browser, and you can see the output: Hello Login Service!

Enter: http://test.serverless.kuberun.com/search in the browser, and you can see the output: Hello Search Service!

Routing and forwarding based on Path + Header

Select the Login-Service service, select the * * Route forwarding * * tab, and click configure. Here we add Header configuration: foo=bar. Click [OK] to save.

Access http://test.serverless.kuberun.com/login and found that service 404 is not accessible.

The explanation is based on Header, so let's configure Header:foo=bar. Com through the ModHeader plug-in in the access request.

After the configuration is complete, we visit the service again: http://test.serverless.kuberun.com/login.

The service accesses OK. This completes the routing forwarding configuration based on Path + Header.

Summary

The Aliyun Knative console allows you to implement custom domain names and routing rules more easily and quickly, so as to create service access available for production. Welcome to communicate with those who are interested in Knative.

Welcome to the Knative communication group.

"Alibaba Yun × × icloudnative × × erverless, containers, Service Mesh and other technical fields, focusing on cloud native popular technology trends, cloud native large-scale landing practice, to do the best understanding of cloud native development × ×

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report