Knative combat: how to configure a custom domain name and routing rules in Knative

file

Author | Yuan Yi, Ali cloud intelligent Business Group Senior Development Engineer

Current Knative support is based on the default domain forwarding, you can configure domain name suffix by the template, but for the user does not specify a full domain name settings. Another problem is based on the ability Path Header and forwarding, in many cases we use the same domain name, to distinguish between different services through the access path.

In response to these two issues, we offer this capability in the cloud Ali Knative, the user can configure a custom domain through the console, and routing and forwarding settings based Path Header. as the picture shows:

file

Custom domain name

Log Ali cloud container service console, enter [Knative] - [Management] component, click Serving components [details].

file

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

file

Configuring Routing Forwarding

[Knative enter] - [] Service Management Console, select the corresponding service. Here we set different Path to Login-Service Service and the Search-Service access to the service.

Login-Service Routing Forwarding Service

Select Login-Service Service, select [routing] Forwarding tab, click [Configuration], select [domain name] test.serverless.kuberun.com, configuration path: / login. Click OK to save.

file

Then proceed to configure the Search-Service service routing rules.

Search-Service Routing Forwarding Service

Select Search-Service service, select [routing] Forwarding tab, click [Configuration], select [domain name] test.serverless.kuberun.com, configuration path: / search. Click OK to save.

file

Service Access

Above routing forwarding configuration is complete, we began to test the service access:

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

file

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

file

Based routing forwarding Path + Header

Select Login-Service Service, select [routing] Forwarding tab, click Configure, here we add Header Configuration: foo = bar. Click OK to save.

file

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

file

Description Based Header is in effect, let's configure the access request by ModHeader plug on Header: foo = bar.

file

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

file

Service access OK. Then we completed the Path + Header-based routing forwarding configuration.

summary

By Ali cloud Knative console allows you to more easily and quickly achieve a custom domain name and routing rules to create access to production services available. Welcome to the exchange of interest Knative.

Welcome to Knative exchange group

file

"Alibaba Cloud native micro-channel public number (ID: Alicloudnative) focus on micro service, Serverless, container, Service Mesh and other technical fields, focusing popular technology trends in cloud native, cloud native large-scale landing practice, do most understand cloud native developers technology public number. "

Guess you like

Origin www.cnblogs.com/alisystemsoftware/p/11777242.html