SAE gateway routes map to the Ingress resource type in Kubernetes. This topic covers how to create, view, update, and delete gateway routes using saectl, with sample YAML configuration files.
Prerequisites
Before you begin, make sure you have:
The saectl tool installed and configured with your AccessKey ID, AccessKey secret, and the region where your application is deployed. For setup instructions, see Install and configure the saectl tool
Create a gateway route
Create a configuration file named
ingress.yaml. The following example shows a complete configuration with inline comments explaining each field. For the full list of supported fields, see YAML configuration reference.apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: sae.aliyun.com/description: test-ingress # Alias for the routing rule sae.aliyun.com/idle-timeout: "15" # Idle connection timeout, in seconds sae.aliyun.com/request-timeout: "60" # Request timeout, in seconds sae.aliyun.com/loadbalancer-id: alb-4iceqaf9jtq0ic7xxx # SLB ID sae.aliyun.com/loadbalancer-port: "443" # SLB listening port sae.aliyun.com/loadbalancer-protocol: HTTPS # Valid values: HTTP, HTTPS sae.aliyun.com/loadbalancer-type: alb # Valid values: clb, alb sae.aliyun.com/loadbalancer-cert-ids: 15408xxx-cn-shenzhen # Required for HTTPS sae.aliyun.com/rule-actions: '{"/sys/(.*)/(.*)/aaa":"[{\"actionType\":\"redirect\",\"actionConfig\":\"{\\\"protocol\\\":\\\"${protocol}\\\",\\\"host\\\":\\\"${host}\\\",\\\"port\\\":\\\"${port}\\\",\\\"path\\\":\\\"/${1}\\\",\\\"query\\\":\\\"${query}\\\",\\\"httpCode\\\":\\\"301\\\"}\"}]"}' name: alb-4iceqaf9jtq0ic7xxx-443 # Format: <SLB ID>-<listening port> namespace: default spec: defaultBackend: # Default forwarding rule service: name: test-app-1 # Backend application for the default rule port: number: 8080 # Container port for the default rule rules: # Custom forwarding rules - host: test.xxx.com http: paths: - backend: service: name: test-app-2 # Backend application for this path port: number: 9000 # Container port for this path path: / pathType: ImplementationSpecific - backend: # Redirect rule — the default value of backend.service.name is dummyRule service: name: dummyRule port: number: 8080 path: /sys/(.*)/(.*)/aaa pathType: ImplementationSpecificFrom the directory containing
ingress.yaml, run the following command:saectl apply -f ingress.yaml
View gateway routes
Run the following command to list gateway routes:
saectl get ingress <ingress-name> -n <namespace><ingress-name>: Name of the gateway route. Omit this to list all gateway routes in scope.<namespace>: Namespace ID. Defaults to thedefaultnamespace if-nis not specified.
The output contains the following fields:
| Field | Description |
|---|---|
| NAMESPACE | Namespace where the gateway route resides |
| NAME | Static identifier in the format <SLB ID>-<port> |
| TYPE | SLB type |
| DESCRIPTION | Alias of the routing rule |
| HOSTS | Domain names |
| PORTS | Ports |
| AGE | How long the gateway route has existed |
View gateway route details
Use either the get or describe command to inspect the full configuration of a gateway route.
Using `get`:
saectl get ingress <ingress-name> -o yaml -n <namespace>
# Replace -o yaml with -o json to get JSON outputUsing `describe`:
saectl describe ingress <ingress-name> -n <namespace>In both commands, <ingress-name> is the name of the gateway route and <namespace> is the namespace ID. Defaults to the default namespace if -n is not specified.
Update a gateway route
Edit inline
Open the gateway route configuration in your editor:
saectl edit ingress <ingress-name> -n <namespace>Modify the configuration, then save and close the file. The changes take effect automatically.
To confirm the update was applied, run:
saectl describe ingress <ingress-name> -n <namespace>
Apply from a file
Modify ingress.yaml, then run:
saectl apply -f ingress.yamlDelete a gateway route
saectl delete ingress <ingress-name> -n <namespace><ingress-name>: Name of the gateway route.<namespace>: Namespace ID. Defaults to thedefaultnamespace if-nis not specified.
YAML configuration reference
The following table describes the Kubernetes YAML configuration fields for SAE gateway routes. Fields marked Required must be specified when creating a gateway route. Fields marked Immutable cannot be changed after creation.
Identity and routing
| Field | Type | Required | Immutable | Description |
|---|---|---|---|---|
metadata.name | String | Yes | Yes | Name of the gateway route. Format: <SLB ID>-<SLB listening port>. Example: alb-4iceqaf9jtq0ic7xxx-443. |
metadata.namespace | String | — | Yes | Namespace where the gateway route resides. |
Load balancer annotations
| Annotation | Type | Required | Immutable | Description |
|---|---|---|---|---|
sae.aliyun.com/loadbalancer-id | String | Yes | Yes | SLB ID. Example: alb-4iceqaf9jtq0ic7xxx. |
sae.aliyun.com/loadbalancer-port | String (integer) | Yes | — | SLB listening port. Example: "443". |
sae.aliyun.com/loadbalancer-protocol | String | — | — | Forwarding protocol. Valid values: HTTP, HTTPS. |
sae.aliyun.com/loadbalancer-type | String | Yes | Yes | Load balancer type. Valid values: clb (Classic Load Balancer), alb (Application Load Balancer). |
sae.aliyun.com/loadbalancer-cert-ids | String | Yes (HTTPS only) | — | Certificate ID. Required when the forwarding protocol is HTTPS. |
Behavior annotations
| Annotation | Type | Required | Immutable | Description |
|---|---|---|---|---|
sae.aliyun.com/description | String | — | — | Alias for the routing rule. |
sae.aliyun.com/idle-timeout | String (seconds) | — | — | Idle connection timeout. Value is in seconds. Example: "15". |
sae.aliyun.com/request-timeout | String (seconds) | — | — | Request timeout. Value is in seconds. Example: "60". |
sae.aliyun.com/rule-actions | String (JSON) | — | — | Custom forwarding rule for redirection actions. |
Forwarding rules
| Field | Type | Required | Immutable | Description |
|---|---|---|---|---|
spec.defaultBackend | Object | Yes | — | Default forwarding rule applied when no custom rule matches. |
spec.defaultBackend.service.name | String | Yes | — | Backend application for the default forwarding rule. |
spec.defaultBackend.service.port.number | Integer | Yes | — | Container port for the default forwarding rule. |
spec.rules | Array | Yes | — | Custom forwarding rules. |
spec.rules[i].host | String | Yes | — | Domain name for the custom forwarding rule. |
spec.rules[i].http.paths[i].path | String | Yes | — | URL path for the custom forwarding rule. Supports regular expressions for redirect rules. |
spec.rules[i].http.paths[i].pathType | String | Yes | — | Path matching behavior. Fixed value: ImplementationSpecific. Path matching is handled by the load balancer. |
spec.rules[i].http.paths[i].service.name | String | Yes | — | Backend application for this path. The default value for redirect-only paths is dummyRule. |
spec.rules[i].http.paths[i].service.port.number | Integer | Yes | — | Container port for this path. |