Ingresos de ELB usando HTTP/2
Los ingresos pueden usar HTTP/2 para exponer los servicios. Las conexiones desde el balanceador de carga a su aplicación usan HTTP/1.X de forma predeterminada. Si su aplicación es capaz de recibir solicitudes de HTTP2, puede agregar el siguiente campo a la anotación de ingreso para habilitar el uso de HTTP/2:
kubernetes.io/elb.http2-enable: 'true'
A continuación se muestra el archivo YAML para asociarse con un balanceador de carga existente:
Para clústeres de v1.21 o anterior:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-test
annotations:
kubernetes.io/elb.id: <your_elb_id> # Replace it with the ID of your existing load balancer.
kubernetes.io/elb.ip: <your_elb_ip> # Replace it with the IP of your existing load balancer.
kubernetes.io/elb.port: '443'
kubernetes.io/ingress.class: cce
kubernetes.io/elb.http2-enable: 'true' # Enable HTTP/2.
spec:
tls:
- secretName: ingress-test-secret
rules:
- host: ''
http:
paths:
- path: '/'
backend:
serviceName: <your_service_name> # Replace it with the name of your target Service.
servicePort: 80 # Replace it with the port number of your target Service.
property:
ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
annotations:
kubernetes.io/elb.id: <your_elb_id> # Replace it with the ID of your existing load balancer.
kubernetes.io/elb.ip: <your_elb_ip> # Replace it with the IP of your existing load balancer.
kubernetes.io/elb.port: '443'
kubernetes.io/elb.http2-enable: 'true' # Enable HTTP/2.
spec:
tls:
- secretName: ingress-test-secret
rules:
- host: ''
http:
paths:
- path: '/'
backend:
service:
name: <your_service_name> # Replace it with the name of your target Service.
port:
number: 8080 # Replace 8080 with the port number of your target Service.
property:
ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH
pathType: ImplementationSpecific
ingressClassName: cce
Tabla 6 Parámetros de HTTP/2
|
Parámetro |
Obligatorio |
Tipo |
Descripción |
|---|---|---|---|
|
kubernetes.io/elb.http2-enable |
No |
Bool |
Si HTTP/2 está habilitado. El reenvío de solicitudes mediante HTTP/2 mejora el rendimiento de acceso entre su aplicación y el balanceador de carga. Sin embargo, el balanceador de carga todavía usa HTTP 1.X para reenviar solicitudes al servidor backend. Este parámetro es compatible con clústeres de v1.19.16-r0, v1.21.3-r0 y versiones posteriores. Opciones:
Nota: HTTP/2 se puede habilitar o deshabilitar solo cuando el oyente usa HTTPS. Este parámetro no es válido cuando el protocolo de oyente es HTTP y el valor predeterminado es false. |