Create a route (Ingress)¶
In a Kubernetes cluster, Ingress exposes services from outside the cluster to inside the cluster HTTP and HTTPS routing. Traffic routing is controlled by rules defined on the Ingress resource. Here's an example of a simple Ingress that sends all traffic to the same Service:
Ingress is an API object that manages external access to services in the cluster, and the typical access method is HTTP. Ingress can provide load balancing, SSL termination, and name-based virtual hosting.
Prerequisites¶
- Container management platform connected to Kubernetes cluster or created Kubernetes, and can access the cluster UI interface.
-
A Namespace Creation, User Creation has been completed, and the user Authorization is the
NS Edit
role, for details, please refer to Namespace Authorization. -
When there are multiple containers in a single instance, please make sure that the ports used by the containers do not conflict, otherwise the deployment will fail.
Create routes¶
-
After successfully logging in as the
NS Edit
user, clickCluster List
in the upper left corner to enter theCluster List
page. In the list of clusters, click a cluster name. -
Click
Services and Routing
on the left, click theRouting
tab, and click theCreate Routing
button in the upper right corner.Tip
It is also possible to create a route via
YAML
. -
Open
Create Route
page to configure. There are two protocol types to choose from, please refer to the following two parameter tables for configuration.
Create a route with protocol HTTP¶
parameter | description | example value |
---|---|---|
Route name | 【Type】Required 【Meaning】Enter the name of the new route. 【Note】Please enter a string of 4 to 63 characters, which can contain lowercase English letters, numbers and dashes (-), and start with a lowercase English letter, lowercase English letters or numbers. | Ing-01 |
Namespace | 【Type】Required 【Meaning】Select the namespace where the new service is located. For more information about namespaces, please refer to Namespace Overview. 【Note】Please enter a string of 4 to 63 characters, which can contain lowercase English letters, numbers and dashes (-), and start with a lowercase English letter and end with a lowercase English letter or number. | default |
Protocol | [Type] Required [Meaning] Refers to the protocol that authorizes inbound access to the cluster service, and supports HTTP (no identity authentication required) or HTTPS (identity authentication needs to be configured) protocol. Here select the route of HTTP protocol. | HTTP |
Domain Name | [Type] Required [Meaning] Use the domain name to provide external access services. The default is the domain name of the cluster | |
Label | [Type] Optional [Meaning] Add a label for the route | |
Annotation | 【Type】Optional 【Meaning】Add annotation for routing |
Create a route with protocol HTTPS¶
parameter | description | example value |
---|---|---|
Route name | 【Type】Required 【Meaning】Enter the name of the new route. 【Note】Please enter a string of 4 to 63 characters, which can contain lowercase English letters, numbers and dashes (-), and start with a lowercase English letter, lowercase English letters or numbers. | Ing-01 |
Namespace | 【Type】Required 【Meaning】Select the namespace where the new service is located. For more information about namespaces, please refer to Namespace Overview. 【Note】Please enter a string of 4 to 63 characters, which can contain lowercase English letters, numbers and dashes (-), and start with a lowercase English letter and end with a lowercase English letter or number. | default |
Protocol | [Type] Required [Meaning] Refers to the protocol that authorizes inbound access to the cluster service, and supports HTTP (no identity authentication required) or HTTPS (identity authentication needs to be configured) protocol. Here select the route of HTTPS protocol. | HTTPS |
Domain Name | [Type] Required [Meaning] Use the domain name to provide external access services. The default is the domain name of the cluster | |
CA certificate | 【Type】Required 【Meaning】Certificate for identity authentication between the server and the client, and you can also upload it locally. | |
Forwarding strategy | 【Type】Optional 【Meaning】Specify the access strategy of Ingress. Path: Specify the URL path for service access, the default is the root path/ Target Service: The service name for routing Target Service Port: The port exposed by the service | |
Label | [Type] Optional [Meaning] Add a label for the route | |
Annotation | 【Type】Optional 【Meaning】Add annotation for routing |
Complete route creation¶
After configuring all the parameters, click the OK
button to return to the routing list automatically. On the right side of the list, click ︙
to modify or delete the selected route.