Create an Ingress
This section describes how to create an Ingress.
| Note |
|---|
After installing the "KubeSphere Gateway" extension and enabling the cluster gateway, workspace gateway, or project gateway, when creating an Ingress, you can select the corresponding gateway’s IngressClassName on the Routing Rule tab. |
Prerequisites
-
You need to join a project and have the Application Workload Management permission in the project. For more information, see Project Members and Project Roles.
-
To create an Ingress that supports the HTTPS protocol, you need to create a TLS Information type Secret. The Secret must contain the Base64-encoded certificate and private key. For more information, please refer to Create a Secret.
-
There is at least one Service in the project to which the Ingress belongs. For more information, please refer to Create a Service.
Steps
-
Log in to the KubeSphere web console with a user who has Application Workload Management permissions and enter your workspace.
-
Click Application Workloads > Ingress in the left navigation pane.
-
Select a project from the drop-down list in the upper left corner of the page.
-
Click Create on the page.
-
On the Basic Information tab, set the basic information for the Ingress, then click Next.
Parameter Description Name
The name of the Ingress. The name can only contain lowercase letters, numbers, and hyphens (-), must start and end with a lowercase letter or number, and can be up to 253 characters long.
Alias
The alias of the Ingress. Different Ingresses can have the same alias.
Description
The description of the Ingress. The description can contain any characters and can be up to 256 characters long.
-
On the Routing Rules tab, click Add Routing Rule to set the routing rule parameters.
-
Click Add Routing Rule to set routing rules. You can set multiple routing rules, each corresponding to a domain name.
-
Hover your mouse over a created routing rule, then click
on the right to edit the routing rule’s settings.
-
Hover your mouse over a created routing rule, then click
on the right to delete the routing rule.
Parameter Description Domain Name
User-defined domain name.
Ingresses under the same gateway (even if they belong to different projects) can use the same domain name.
Ingresses under different gateways are not allowed to use the same domain name to avoid mutual interference between ingresses and prevent errors in production business.
Protocol
The protocol supported by the Ingress, the parameter value can be HTTP or HTTPS.
Secret
When the Ingress protocol is HTTPS, the Secret used to provide the certificate and key. This Secret must contain the tls.cert and tls.key fields, storing the Base64-encoded certificate and private key respectively.
Path
Domain path and its mapping relationship with the service port.
-
Click Add to set multiple paths.
-
Click
on the right of a created path to delete the path.
-
-
(Optional) On the Routing Rules tab, click Path Rewrite to configure a rewrite path for the current routing rule using a regular expression, then click Next.
-
Path rewrite refers to modifying the URL path of a client request before forwarding it to the backend service. The Rewrite Path text box should contain the path to be sent to the backend service.
-
Path rewrite applies to all routing rules under the current Ingress.
-
If multiple paths require path rewriting, you can create multiple Ingresses to achieve this.
-
-
On the Advanced Settings tab, set labels and annotations for the Ingress, then click Create.
-
Click Add to set multiple labels or annotations.
-
Click
on the right side of a created label or annotation to delete it.
Note KubeSphere’s cluster gateway and project gateway are implemented based on the Nginx Ingress Controller. You can set annotations on the Ingress to control the gateway’s behavior. For more information, please refer to the Nginx Ingress Controller official documentation.
After creation, the Ingress will be displayed in the Ingress list.
-