https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/
alb.ingress.kubernetes.io/load-balancer-name: alb-name
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}, {"HTTP": 8080}, {"HTTPS": 8443}]'
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/ip-address-type: ipv4
alb.ingress.kubernetes.io/actions.${action-name}
예시
-> /path1이라는 경로에 접속하면 상태코드 200이 응답한다.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: default
name: ingress
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/actions.rule-path1: >
{"type":"fixed-response","fixedResponseConfig":{"contentType":"text/plain","statusCode":"200","messageBody":"Host is www.example.com OR anno.example.com"}}
spec:
ingressClassName: alb
rules:
- http:
paths:
- path: /path1
pathType: Prefix
backend:
service:
name: rule-path1
port:
name: use-annotation
예시
-> 가중치 기반 로드벨런싱
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: default
name: ingress
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/target-group-attributes: stickiness.enabled=true,stickiness.lb_cookie.duration_seconds=60
alb.ingress.kubernetes.io/actions.weighted-routing: |
{
"type":"forward",
"forwardConfig":{
"targetGroups":[
{
"serviceName":"service-1",
"servicePort":"80",
"weight":50
},
{
"serviceName":"service-2",
"servicePort":"80",
"weight":50
}
],
"TargetGroupStickinessConfig": {
"Enabled": true,
"DurationSeconds": 120
}
}
}
spec:
ingressClassName: alb
rules:
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: weighted-routing
port:
name: use-annotation
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/auth-type: cognito
alb.ingress.kubernetes.io/auth-idp-cognito: '{"userPoolARN":"arn:aws:cognito-idp:us-west-2:xxx:userpool/xxx","userPoolClientID":"my-clientID","userPoolDomain":"my-domain"}'
apiVersion: v1
kind: Secret
metadata:
namespace: testcase
name: my-k8s-secret
data:
clientID: base64 of your plain text clientId
clientSecret: base64 of your plain text clientSecret
alb.ingress.kubernetes.io/auth-on-unauthenticated-request: authenticate
options:
authenticate: 구성된 IDP로 인증을 시도한다.
deny: HTTP 401 Unauthorized 오류를 반환한다.
allow: 요청이 대상으로 전달되도록 허용한다.
alb.ingress.kubernetes.io/auth-session-cookie: custom-cookie
alb.ingress.kubernetes.io/auth-session-timeout: '86400'
instance 방식 or IP 방식
인스턴스 방식
alb.ingress.kubernetes.io/target-type: instance
alb.ingress.kubernetes.io/target-node-labels: label1=value1, label2=value2
alb.ingress.kubernetes.io/backend-protocol: HTTPS
alb.ingress.kubernetes.io/healthcheck-protocol: HTTPS
alb.ingress.kubernetes.io/healthcheck-port: '80'
alb.ingress.kubernetes.io/healthcheck-protocol: HTTPS
alb.ingress.kubernetes.io/healthcheck-path: /ping
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '10'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '8'
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'