You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
ALB Ingress
Configuring ALB Ingress using annotation
Copy page
Download PDF
Configuring ALB Ingress using annotation
An Application Load Balancer (ALB) Ingress allows you to configure powerful ALB capabilities through annotations. This topic introduces the typical scenarios of configuring an ALB Ingress through annotations.​
warning​
  • The annotations in YAML files are case-sensitive.​
  • VKE clusters can be associated with Basic and Standard instances of ALB to meet the load balancing requirements of clusters of different sizes. The features that can be configured slightly vary based on the ALB type. For details, see Overview of ALB instance editions.​
  • To associate with a Standard edition ALB instance, upgrade the alb-ingress-controller add-on to version v0.31.1 or later. For details, see Upgrading add-ons.​
Configure listeners​
Selecting a single listener​
tip​
Before using an annotation to select a listener for an ALB instance, you must first create or associate the corresponding ALB instance and listener through an ALBInstance. For configuration details, see Creating ALB Ingresses by using kubectl.​
An ALB Ingress allows you to use an annotation to select a single listener created by an ALB instance and configure forwarding rules and backend server groups in the listener. The following YAML content provides an example:​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress # The name of the Ingress.​
namespace: default # Namespace of the Ingress​
annotations:​
ingress.vke.volcengine.com/loadbalancer-port: "80" # Listening port.​
ingress.vke.volcengine.com/loadbalancer-protocol: "http" # The listener protocol. Values: http and https.​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/loadbalancer-port​
String​
Select the listening port for the listener. Ensure that the listener has been configured with the corresponding listening port.​
80​
ingress.vke.volcengine.com/loadbalancer-protocol​
String​
Select the protocol for the listener. Valid values:​
  • http: The HTTP protocol.​
  • https: The HTTPS protocol.​
http​
​
Selecting multiple listeners​
tip​
Before using an annotation to select a listener for an ALB instance, you must first create or associate the corresponding ALB instance and listener through an ALBInstance. For configuration details, see Creating ALB Ingresses by using kubectl.​
An ALB Ingress allows you to use annotations to select multiple listeners created by an ALBInstance and configure forwarding rules and backend server groups in the listeners. The following YAML content provides an example:​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress # The name of the Ingress.​
namespace: default # Namespace of the Ingress​
annotations:​
ingress.vke.volcengine.com/listen-ports: '[{"HTTP": 80},{"HTTPS": 443}]' # Select multiple listeners. The configuration includes their listener protocol and port number.​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/listen-ports​
Array of String​
Select the protocol and port number for multiple listeners. Example: {"HTTP": 80}. You can specify a list of multiple values separated by commas (,)​
tip​
  • If you use the annotation to select multiple listeners, the ingress.vke.volcengine.com/loadbalancer-port and ingress.vke.volcengine.com/loadbalancer-protocol of individual listeners become invalid.​
  • When the annotation is deleted, the automatically created forwarding rules will also be deleted.​
None​
​
Configuring forwarding rules​
Configuring multi-domain or multi-path traffic forwarding​
warning​
This configuration is supported only when an ALB Ingress is associated with a Standard edition ALB instance.​
  • The {{service-name}} field in the annotation must match the name of the back-end service configured in spec.rules. For example, in this case, the correct annotation is ingress.vke.volcengine.com/loadbalancer-conditions.service-demo.​
  • The hostConfig configured in the annotation will be merged with the host in spec.rules. For example, in this case, after the forwarding rules are merged, requests where the host is example.com or example-2.com will all be forwarded to the service-demo service.​
  • The pathConfig configured in the annotation will be merged with the path in spec.rules (path). For example, after the forwarding rules are merged in this case, requests with a path of /path1 or /path2 will be forwarded to the service-demo service.​
The following alb-ingress.yaml file provides an example:​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress # The name of the Ingress.​
namespace: default # Namespace of the Ingress​
annotations:​
ingress.vke.volcengine.com/loadbalancer-conditions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "Host",​
"hostConfig": {​
"values": [​
"example-2.com"​
]​
}​
},​
{​
"type": "Path",​
"pathConfig": {​
"values": [​
"/path2"​
]​
}​
}​
]​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: /path1 # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The Service port number to forward to.​
​
Configuring header-based traffic forwarding​
An ALB Ingress allows you to configure forwarding rules via annotations to implement traffic forwarding based on specific HTTP request headers (such as User-Agent and Content-Type). Only a matched request will be forwarded. For a complete configuration example and parameter description, see Configuring traffic forwarding based on headers.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-conditions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "Header",​
"headerConfig": {​
"key": "header-key-1",​
"values": [​
"header-value-1"​
]​
}​
}​
]​
​
Configuring traffic forwarding based on request methods​
An ALB Ingress allows you to configure forwarding rules via annotations to implement traffic forwarding based on specific request methods (such as GET and POST). Only a matched request will be forwarded. For a detailed configuration example and parameter description, see Configuring traffic forwarding based on request methods.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-conditions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "Method",​
"methodConfig": {​
"values": [​
"GET",​
"POST"​
]​
}​
}​
]​
​
Configuring query string-based traffic forwarding​
An ALB Ingress allows you to configure forwarding rules via annotations to implement traffic forwarding based on query parameters in URLs. Only a matched request will be forwarded. For a detailed configuration example and parameter description, see Configuring traffic forwarding based on query strings.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-conditions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "QueryString",​
"queryStringConfig": {​
"values": [​
{​
"key": "key1",​
"value": "value1"​
},​
{​
"key": "key2",​
"value": "value2"​
}​
]​
}​
}​
]​
​
Configure rewrites​
An ALB Ingress supports path rewriting via annotations, allowing the modification of the request paths to fetch content from a new path on the back-end server. For a detailed configuration example and parameter description, see Configuring path rewrites for traffic forwarding.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-actions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "Rewrite",​
"rewriteConfig": {​
"path": "/aaa"​
}​
}​
]​
​
Quickly configure HTTP-to-HTTPS redirection​
For ALB Ingresses, you can use annotations to quickly configure HTTP-to-HTTPS redirection. This allows requests to the HTTP/80 listener to always be redirected to HTTPS/443 while preserving the original host, path, and query. For a detailed configuration example and parameter description, see Configuring redirection for traffic forwarding.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/ssl-redirect: "true" # Enable HTTP-to-HTTPS redirection​
​
​
Configuring redirection​
An ALB Ingress allows you to configure redirection via annotations to redirect access requests to a specified path. For a detailed configuration example and parameter description, see Configuring redirection for traffic forwarding.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-actions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "Redirect",​
"redirectConfig": {​
"host": "example.com",​
"path": "/",​
"httpCode": "301",​
"port": 443,​
"protocol": "HTTPS"​
}​
}​
]​
​
Configuring traffic throttling​
An ALB Ingress supports configuring traffic throttling based on annotations to limit the rate of requests. For a detailed configuration example and parameter description, see Configuring traffic throttling for traffic forwarding.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-actions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "TrafficLimit",​
"trafficLimitConfig": {​
"qps": 100​
}​
}​
]​
​
Configuring fixed responses​
An ALB Ingress supports configuring fixed responses using annotations, allowing you to directly return a fixed response without forwarding requests to the back-end server. For specific configuration examples and parameter descriptions, see Configuring fixed response.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-actions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "FixedResponse",​
"fixedResponseConfig": {​
"content": "response message",​
"contentType": "text/plan",​
"httpCode": "200"​
}​
}​
]​
​
Configure CORS​
ALB Ingresses support cross-origin access configuration based on the annotation. For a detailed configuration example and parameter descriptions, see Configuring cross-origin traffic forwarding.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-actions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[​
{​
"type": "Cors",​
"corsConfig": {​
"allowOrigin": ["*"],​
"allowMethods": ["GET","POST","OPTIONS","PUT","PATCH","DELETE","HEAD"],​
"allowHeaders": ["Content-Type","Authorization"],​
"exposeHeaders": ["X-Custom-Header","Content-Length"],​
"allowCredentials": "off",​
"maxAge": 3600​
}​
},​
{​
"type": "ForwardGroup",​
"forwardGroupConfig": {​
"backends": [​
{​
"serviceName": "service-demo",​
"servicePort": 80​
}​
]​
}​
}​
]​
​
Configuring traffic forwarding to multiple back-end services​
An ALB Ingress allows you to configure request forwarding based on annotations simultaneously to pods within the cluster (default back-end server group) and ECS server groups outside the cluster (custom back-end server groups) based on specified weights. For a specific configuration example and parameter description, see Configuring forwarding to multiple back-end services.​
The following code provides an example annotation:​
​
ingress.vke.volcengine.com/loadbalancer-actions.{{service-name}}: | # Replace {{service-name}} with the name of the service.​
[{​
"type": "ForwardGroup",​
"forwardGroupConfig": {​
"serverGroupStickySession": {​
"enabled": "on",​
"timeout": 100​
},​
"backends": [​
{​
"serviceName": "service-demo-a",​
"weight": 80,​
"servicePort": 80​
},​
{​
"serviceName": "service-demo-b",​
"weight": 20,​
"servicePort": 80​
}​
]​
}​
}]​
​
Server group configuration​
Specifying a scheduling algorithm​
ALB Ingresses support annotations for configuring the scheduling algorithm of back-end server groups. The following content provides an example:​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress # The name of the Ingress.​
namespace: default # Namespace of the Ingress​
annotations:​
ingress.vke.volcengine.com/loadbalancer-scheduler: "wrr" # The scheduling algorithm for back-end server groups. Valid values include wrr, wlc, and sh.​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/loadbalancer-scheduler​
String​
The scheduling algorithm used by the ALB back-end server group. Valid values:​
  • wrr: Weighted Round Robin. Back-end servers with higher weight values are polled ‌more frequently (with a higher probability)‌.​
  • wlc: Weighted Least Connections. ‌The algorithm extends the least connections algorithm‌ by assigning different weights to servers based on their ‌processing capacity‌, enabling each server to handle a number of service requests proportional to its weight.​
  • sh: Source IP Hash. ‌The algorithm uses consistent hashing‌ based on source IP addresses. Requests from the same source address ‌are directed to‌ the same back-end server.​
wrr​
​
Configuring health check​
Configuring HTTP health checks​
tip​
To specify an HTTP version and port for health checking, upgrade the alb-ingress-controller add-on to v0.37.0 or later. For details, see Upgrading add-ons.​
An ALB Ingress supports HTTP health checks for back-end server groups based on annotations. The following is an example YAML with annotations.​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
annotations:​
ingress.vke.volcengine.com/loadbalancer-healthcheck-enabled: "true" # Whether to enable health checking. Values: true and false​
ingress.vke.volcengine.com/loadbalancer-healthcheck-protocol: "http" # The health check protocol. Valid values include http and tcp. In this example, http is used.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-domain: "example.com" # The domain name for health checks.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-path: "/" # Health check path (default: "/").​
ingress.vke.volcengine.com/loadbalancer-healthcheck-method: "GET" # The health check method. Valid values include GET and HEAD.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-http-version: "HTTP1.0" #The HTTP version for health checking. Valid values include HTTP1.0 and HTTP1.1.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-port: "80" # The port for health checking. The value range is 0 to 65535. A value of 0 means using the back-end server port for health checking.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-httpcode: "http_2xx,http_3xx" # Status codes of health checks. Values: http_2xx (default), http_3xx (default), http_4xx, and http_5xx.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-timeout: "2" # The response timeout for a health check. Value range: 1-60​
ingress.vke.volcengine.com/loadbalancer-healthcheck-interval: "2" # The time interval for performing health checks. The valid range is 1 to 300 seconds.​
ingress.vke.volcengine.com/loadbalancer-healthy-threshold: "3" # The number of health checks required to determine that back-end servers are normal. Value range: 2 to 10​
ingress.vke.volcengine.com/loadbalancer-unhealthy-threshold: "3" # The number of health checks required to determine that back-end servers are unhealthy. Value range: 2 to 10​
name: alb-ingress # The custom Ingress name.​
namespace: default # Namespace of the Ingress​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/loadbalancer-healthcheck-enabled​
String​
Whether to enable health check. Valid values:​
  • true: Enable health checking.​
  • false: Disable health checking.​
false​
ingress.vke.volcengine.com/loadbalancer-healthcheck-protocol​
String​
The health check protocol. In this example, set the value to http.​
http​
ingress.vke.volcengine.com/loadbalancer-healthcheck-domain​
String​
The domain name for health checks. ALB populates this domain name in the host field.​
If no domain name is configured, the host field is left empty, and ALB does not include the host field in requests and the default domain name (internal IP address of the back-end server group) will apply.​
None​
ingress.vke.volcengine.com/loadbalancer-healthcheck-path​
String​
The health check path. The default path is /.​
/​
ingress.vke.volcengine.com/loadbalancer-healthcheck-method​
String​
The health check method. Available values: GET, HEAD.​
GET​
ingress.vke.volcengine.com/loadbalancer-healthcheck-http-version​
String​
The HTTP version for health checking. Valid values:​
  • HTTP1.0 (default)​
  • HTTP1.1​
HTTP1.0​
ingress.vke.volcengine.com/loadbalancer-healthcheck-port​
String​
The health check port.​
  • 0: (Default) Use the back-end server port for health checking.​
  • 1–65535: Use the specified port for health checking.​
0​
ingress.vke.volcengine.com/loadbalancer-healthcheck-httpcode​
String​
The status code for a normal health check.​
Values: http_2xx, http_3xx, http_4xx, and http_5xx.​
http_2xx,http_3xx​
ingress.vke.volcengine.com/loadbalancer-healthcheck-timeout​
String​
The response timeout for a health check.​
  • Value range: 1–60​
  • Unit: seconds​
2​
ingress.vke.volcengine.com/loadbalancer-healthcheck-interval​
String​
The time interval for performing health checks.​
  • Value range: 1–300​
  • Unit: seconds​
2​
ingress.vke.volcengine.com/loadbalancer-healthy-threshold​
String​
The number of consecutive health check requests required to determine that the back-end server is running properly.​
  • Value range: 2–10​
  • Unit: times​
3​
ingress.vke.volcengine.com/loadbalancer-unhealthy-threshold​
String​
The number of consecutive health check requests required to determine that the back-end server is not running properly.​
  • Value range: 2–10​
  • Unit: times​
3​
​
Configuring TCP health checks​
An ALB Ingress supports TCP health checks for back-end server groups based on annotations. The following is an example YAML with annotations.​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
annotations:​
ingress.vke.volcengine.com/loadbalancer-healthcheck-enabled: "true" # Whether to enable health checking. Values: true and false​
ingress.vke.volcengine.com/loadbalancer-healthcheck-protocol: "tcp" # The health check protocol. Valid values: http and tcp In this example, set the value to tcp.​
ingress.vke.volcengine.com/loadbalancer-healthcheck-timeout: "2" # The response timeout for a health check. Value range: 1-60​
ingress.vke.volcengine.com/loadbalancer-healthcheck-interval: "2" # The time interval for performing health checks. The valid range is 1 to 300 seconds.​
ingress.vke.volcengine.com/loadbalancer-healthy-threshold: "3" # The number of health checks required to determine that back-end servers are normal. Value range: 2 to 10​
ingress.vke.volcengine.com/loadbalancer-unhealthy-threshold: "3" # The number of health checks required to determine that back-end servers are unhealthy. Value range: 2 to 10​
name: alb-ingress # The custom Ingress name.​
namespace: default # Namespace of the Ingress​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/loadbalancer-healthcheck-enabled​
String​
Whether to enable health check. Valid values:​
  • true: Enable health checking.​
  • false: Disable health checking.​
false​
ingress.vke.volcengine.com/loadbalancer-healthcheck-protocol​
String​
The health check protocol. In this example, set the value to tcp.​
http​
ingress.vke.volcengine.com/loadbalancer-healthcheck-timeout​
String​
The response timeout for a health check.​
  • Value range: 1–60​
  • Unit: seconds​
2​
ingress.vke.volcengine.com/loadbalancer-healthcheck-interval​
String​
The time interval for performing health checks.​
  • Value range: 1–300​
  • Unit: seconds​
2​
ingress.vke.volcengine.com/loadbalancer-healthy-threshold​
String​
The number of consecutive health check requests required to determine that the back-end server is running properly.​
  • Value range: 2–10​
  • Unit: times​
3​
ingress.vke.volcengine.com/loadbalancer-unhealthy-threshold​
String​
The number of consecutive health check requests required to determine that the back-end server is not running properly.​
  • Value range: 2–10​
  • Unit: times​
3​
​
Configuring health checks for the specified back-end service group​
The aforementioned health check configurations based on HTTP and TCP apply to all back-end server groups created by an ALB Ingress. To configure a different health check policy for a specified back-end server group (in this example, second.example.com), use the annotation in the following example:​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress​
annotations:​
ingress.vke.volcengine.com/loadbalancer-rules-configs: |​
[​
{​
"host": "second.example.com",​
"path": "/",​
"healthCheck":​
{​
"enabled": true,​
"protocol": "http",​
"method": "GET",​
"httpcode": "http_2xx,http_3xx",​
"timeout": 2,​
"interval": 2,​
"healthyThreshold": 3,​
"unhealthyThreshold": 3​
}​
}​
]​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: first.example.com​
http:​
paths:​
- pathType: Prefix​
path: /​
backend:​
service:​
name: service-demo-a​
port:​
number: 80​
- host: second.example.com​
http:​
paths:​
- pathType: Prefix​
path: /​
backend:​
service:​
name: service-demo-b​
port:​
number: 80​
​
The following table describes fields in the ingress.vke.volcengine.com/loadbalancer-rules-configs annotation.​
​
Field​
Type​
Description​
Default value​
host​
String​
The domain name that the rule applies to.​
None​
path​
String​
The path that the rule applies to.​
None​
healthCheck​
Array of healthCheck​
The health check rules for back-end server groups.​
None​
​
healthCheck​
​
Field​
Type​
Description​
Default value​
enabled​
Boolean​
Whether to enable health checking for the back-end service group. Valid values:​
  • true: Enable health checking for the specified back-end service group.​
  • false: Disable health checking for the specified back-end service group.​
None​
protocol​
String​
The protocol for health checks. In this case, use http.​
None​
method​
String​
The health check method. Available values: GET, HEAD.​
HEAD​
httpcode​
String​
The HTTP status code for a normal health check. Values: http_2xx, http_3xx, http_4xx, and http_5xx.​
http_2xx,http_3xx​
timeout​
Integer​
The response timeout for the health check. If the backend server does not respond correctly within the specified time, it is considered anomalous. The value range is 1 to 60 seconds.​
warning​
The response timeout must be less than or equal to the check interval.​
2​
interval​
Integer​
Health check interval. The valid range is 1 to 300 seconds.​
2​
healthyThreshold​
Integer​
The health threshold for health checking. The threshold is the number of consecutive health checks: if that many consecutive checks on a back-end server pass, the server is considered healthy. The value range is 2 to 10.​
3​
unhealthyThreshold​
Integer​
The threshold for an unhealthy result of health checking. The threshold is the number of consecutive health checks: if all consecutive checks on a back-end server fail, the server is considered unhealthy. The value range is 2 to 10.​
3​
​
Configuring a communication protocol for back-end server groups​
An ALB Ingress supports configuring the communication protocol between back-end server groups based on annotations. The following content provides an example:​
warning​
  • Only standard ALB instances support backend protocols HTTPS and gRPC.​
  • The alb-ingress-controller add-on has been installed and upgraded to v0.33.1 or later. For details, see Upgrading add-ons.​
  • This configuration can only be set during the creation of an ALB Ingress and cannot be modified after creation is complete.​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress # The name of the Ingress.​
namespace: default # Namespace of the Ingress​
annotations:​
ingress.vke.volcengine.com/loadbalancer-port: "80" # The listening port. When the communication protocol for back-end server groups is gRPC, specify a port for HTTPS listeners, such as 443.​
ingress.vke.volcengine.com/loadbalancer-protocol: "http" # Listener protocol. Values: http and https. When the communication protocol of the back-end server group is grpc, the value should be https.​
ingress.vke.volcengine.com/loadbalancer-backend-protocol: "http" # The communication protocol for back-end server groups. Valid values include http, https, and grpc.​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/loadbalancer-backend-protocol​
String​
The communication protocol for back-end server groups. Valid values:​
  • http (default): The communication protocol is HTTP. You can specify HTTP and HTTPS listeners.​
  • https: The communication protocol is HTTPS. You can specify HTTP and HTTPS listeners.​
  • grpc: The communication protocol is gRPC. You can specify HTTP/2 listeners.​
warning​
To use gRPC, first confirm that the HTTP/2 protocol is enabled on the ALB listener. You can enable HTTP/2 by using the listeners.enableHTTP2 field of the ALB instance. For details, see Creating ALB Ingresses by using kubectl.​
http​
​
Others​
Configuring LB-to-pod direct access mode​
warning​
The LB-to-pod direct access mode is only effective in clusters running with VPC-CNI network model.​
An ALB Ingress supports LB-to-pod direct access configuration via annotations. The following content provides an example:​
​
apiVersion: networking.k8s.io/v1​
kind: Ingress​
metadata:​
name: alb-ingress # The name of the Ingress.​
namespace: default # Namespace of the Ingress​
annotations:​
ingress.vke.volcengine.com/loadbalancer-pass-through: "true" # Configure the LB-to-pod direct access mode.​
spec:​
ingressClassName: alb # The name of the ALBInstance resource.​
rules:​
- host: example.com # Domain names for external access​
http:​
paths:​
- pathType: Prefix # Path matching rule, with Prefix (prefix matching) as the default setting.​
path: / # The matching path for the request.​
backend:​
service:​
name: service-demo # The name of the service to forward requests to.​
port: ​
number: 80 # The service port number to forward to.​
​
The following table describes the annotations.​
​
Field​
Type​
Description​
Default value​
ingress.vke.volcengine.com/loadbalancer-pass-through​
String​
Select whether to enable the LB-to-pod direct access mode for the ALB instance. Valid values:​
  • true: Enable the LB-to-pod direct access mode.​
  • false: Disable the LB-to-pod direct access mode.​
false​
​
​
Last updated: 2026.09.03 16:10:56