Configuring a Custom Header Forwarding Policy for a LoadBalancer Ingress
Dedicated load balancer ingresses support custom header forwarding policies. You can configure different header key-value pairs to determine the backend Service to which data is forwarded.
Prerequisites
- v1.23: v1.23.16-r0 or later
- v1.25: v1.25.11-r0 or later
- v1.27: v1.27.8-r0 or later
- v1.28: v1.28.6-r0 or later
- v1.29: v1.29.2-r0 or later
Using kubectl
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: test-header namespace: default annotations: kubernetes.io/elb.port: '80' kubernetes.io/elb.id: 08eab934-1636-4d90-a4cd-cb3fa4330411 kubernetes.io/elb.class: performance # A dedicated load balancer is required. # Path /a can be accessed only through Header key1=value1 or key1=value2. The accessed Service is svc-a:80. kubernetes.io/elb.headers.svc-a: | { "key": "key1", "values": [ "value1", "value2" ] } # Path /b can be accessed only through Header key2=value1 or key2=value2. The accessed Service is svc-b:81. kubernetes.io/elb.headers.svc-b: | { "key": "key2", "values": [ "value1", "value2" ] } spec: rules: - host: '' http: paths: - path: /a backend: service: name: svc-a port: number: 80 property: ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH pathType: ImplementationSpecific - path: /b backend: service: name: svc-b port: number: 81 property: ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH pathType: ImplementationSpecific ingressClassName: cce
Parameter |
Type |
Description |
---|---|---|
kubernetes.io/elb.headers.${svc_name} |
String |
Custom header of the Service associated with an ingress. ${svc_name} is the Service name. Format: a JSON string, for example, {"key": "test", "values": ["value1", "value2"]}
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot