Create a route
Create a route to enable flexible and reliable traffic routing. This topic describes how to create a route (Ingress) in the Container Service console using the UI wizard.
Currently, you can access the backend services of an Ingress only from within a VPC using an internal-facing SLB.
Prerequisites
A cluster has been created. For more information, see Create a cluster.
The services for routing have been created. For more information, see Create a service.
Create a route
Log on to the Container Service console. In the navigation pane on the left, click Network > Routes.
On the Routes page, select the namespace where you want to create the route and click Create Route.
On the Create Route page, configure the basic information for the route:
Route Name: Required. The name must be 1 to 63 characters in length and can contain only lowercase letters, digits, and hyphens (-). It must start and end with a letter or a digit.
Custom Annotation: Optional. For more information about Ingress annotations, see Annotations.
Configure routing rules. These rules allow inbound requests to reach services in the cluster. The rules include the domain name, access path, backend service, and port.
Domain Name: Required. You can use one of the following two types of domain names:
Use the default domain name of the cluster to provide external access. The default domain name is in the format
*.[cluster-id].[region-id].alicontainer.com. You can find the default domain name on the Basic Information page of the cluster.Use a custom domain name. You can use a virtual hostname as a test domain name for external access, such as
example.aliyundoc.com. If you use a custom test domain name, you must add a mapping rule to your local hosts file. The following example shows a mapping rule:192.168.0.254 example.aliyundoc.comNoteThis is the IP address of the Ingress. You can go to Network > Services to find the virtual IP (VIP) address of the flyover-ingress service in the kube-system namespace.
HTTP Rule: Required. Configure the access path, name, port, and weight of the service.
Path: Specify the URL path for service access. Each path is associated with a backend service. The path must start with a forward slash (/). You can use the root path
/.NoteThe system first checks if the path is a regular expression. If it is, Regex Match is used. Otherwise, an exact match is used.
Service Name: Select the backend service to which requests are forwarded. The service must be in the same namespace.
Port: Select the frontend port exposed by the service.
Load Balancing Rule: The supported methods include round-robin, least connections, and random.
Weight: Set the weights for multiple services under this path. Service weights are relative. A single path can map to multiple services. This lets you flexibly configure the relative weights for routing traffic to different services.
Header Rule: Optional. If you set a header rule, only requests with headers that match the rule are routed to the service specified for the path. This lets you split traffic based on the request header.
Associated HTTP Rule: Consists of
Domain Name + Path.Name, Match Value: Custom request fields. The name and match value form a key-value pair.
Match Type: Regex Match and exact match are supported.
Click Submit.