大网数据广告活动
服务器运维问答

HTTP/2 for ALB with EKS on AWS

· 52CE 我爱测

I'm experimenting with AWS EKS and have created the following setup: EKS cluster with a single service/pod/node AWS ALB ingress controller ALB I try to configure the ALB to: create access logs provide HTTP/2 support My alb ingres…

问题原文

原帖链接 · chrisvdb · CC BY-SA 4.0

I'm experimenting with AWS EKS and have created the following setup:

  • EKS cluster with a single service/pod/node
  • AWS ALB ingress controller
  • ALB

I try to configure the ALB to:

  • create access logs
  • provide HTTP/2 support

My alb ingress controller definition:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: alb-ingress-controller
  name: alb-ingress-controller
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: alb-ingress-controller
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: alb-ingress-controller
    spec:
      containers:
        - args:
            - --ingress-class=alb
            - --cluster-name=eks
          image: docker.io/amazon/aws-alb-ingress-controller:v1.1.2
          imagePullPolicy: Always
          name: server
          resources: {}
          terminationMessagePath: /dev/termination-log
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext: {}
      terminationGracePeriodSeconds: 30
      serviceAccountName: alb-ingress
      serviceAccount: alb-ingress

My service & ingress definition:

apiVersion: v1
kind: Service
metadata:
  name: my-app
spec:
  ports:
    - port: 5001
      targetPort: 5001
      protocol: TCP
  type: NodePort
  selector:
    app: my-app
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "my-app"
  labels:
    app: my-app
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/load-balancer-attributes: "access_logs.s3.enabled=true,access_logs.s3.bucket=my-bucket,access_logs.s3.prefix=some-path"
    alb.ingress.kubernetes.io/load-balancer-attributes: "routing.http2.enabled=true"
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: "my-app"
              servicePort: 5001

Result:

  • ALB gets correctly created & traffic gets routed correctly
  • but no HTTP/2 support (although AWS console says 'enabled' for HTTP/2, which is the default)
  • and no ALB logs in S3 (although all permissions provided)

I have checked the ALB logs (kubectl logs -n kube-system $(kubectl get po -n kube-system | egrep -o alb-ingress[a-zA-Z0-9-]+)) and did not find any error message or warning.

Did anyone else get this to work?

已采纳解答

原帖链接 · chrisvdb · CC BY-SA 4.0

I have solved these two issues in the meantime. Quick summary in case somebody else struggles with the same:

  • all alb.ingress.kubernetes.io/load-balancer-attributes need to be combined in a single comma-separated statement -> solved the S3 log issue

    alb.ingress.kubernetes.io/load-balancer-attributes: "access_logs.s3.enabled=true,access_logs.s3.bucket=bucket-name,access_logs.s3.prefix=some-prefix"

  • HTTPS needs to be enabled for HTTP/2 -> solved the HTTP/2 issue

    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80,"HTTPS":443}]' alb.ingress.kubernetes.io/certificate-arn: "arn:aws:acm:ap-southeast-1:1234567891011:certificate/some-UID"

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-03-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。