我正在试验 AWS EKS 并创建了以下设置:
- 具有单个服务/pod/节点的 EKS 集群
- AWS ALB 入口控制器
- ALB
我尝试将 ALB 配置为:
- 创建访问日志
- 提供 HTTP/2 支持
我的 alb 入口控制器定义:
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
我的服务和入口定义:
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
结果:
- 正确创建 ALB 并正确路由流量
- 但不支持 HTTP/2(尽管 AWS 控制台为 HTTP/2 显示“启用”,这是默认设置)
- 并且 S3 中没有 ALB 日志(尽管提供了所有权限)
我检查了 ALB 日志(kubectl logs -n kube-system $(kubectl get po -n kube-system | egrep -o alb-ingress[a-zA-Z0-9-]+))并没有发现任何错误消息或警告。
有没有其他人让这个工作?