Skip to content

Commit 9e6c703

Browse files
authored
Sticky weighted routing (#2740)
* add example for sticky sessions with weighted routing * fix typo
1 parent d47fbe1 commit 9e6c703

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

docs/guide/ingress/annotations.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,58 @@ Traffic Routing can be controlled with following annotations:
436436
name: use-annotation
437437
```
438438

439+
!!!note
440+
If you are using `alb.ingress.kubernetes.io/target-group-attributes` with `stickiness.enabled=true`, you should add `TargetGroupStickinessConfig` under `alb.ingress.kubernetes.io/actions.weighted-routing`
441+
442+
!!!example
443+
444+
```yaml
445+
apiVersion: networking.k8s.io/v1
446+
kind: Ingress
447+
metadata:
448+
namespace: default
449+
name: ingress
450+
annotations:
451+
alb.ingress.kubernetes.io/scheme: internet-facing
452+
alb.ingress.kubernetes.io/target-type: ip
453+
alb.ingress.kubernetes.io/target-group-attributes: stickiness.enabled=true,stickiness.lb_cookie.duration_seconds=60
454+
alb.ingress.kubernetes.io/actions.weighted-routing: |
455+
{
456+
"type":"forward",
457+
"forwardConfig":{
458+
"targetGroups":[
459+
{
460+
"serviceName":"service-1",
461+
"servicePort":"80",
462+
"weight":50
463+
},
464+
{
465+
"serviceName":"service-2",
466+
"servicePort":"80",
467+
"weight":50
468+
}
469+
],
470+
"TargetGroupStickinessConfig": {
471+
"Enabled": true,
472+
"DurationSeconds": 120
473+
}
474+
}
475+
}
476+
spec:
477+
ingressClassName: alb
478+
rules:
479+
- host: www.example.com
480+
http:
481+
paths:
482+
- path: /
483+
pathType: Prefix
484+
backend:
485+
service:
486+
name: weighted-routing
487+
port:
488+
name: use-annotation
489+
```
490+
439491
## Access control
440492
Access control for LoadBalancer can be controlled with following annotations:
441493

0 commit comments

Comments
 (0)