我在 AWS 上使用 EKS(EKS 版本:1.21),并且我在两个不同的名称空间上部署了两个不同的应用程序。 当我部署入口时,它会为我创建两个应用程序负载均衡器而不是一个 ALB, 我想要一个 ALB,其中多个入口指向两个不同的命名空间
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: tenant1
name: ingress-apps
labels:
app: ingress-app
annotations:
# Ingress Core Settings
kubernetes.io/ingress.class: "alb"
alb.ingress.kubernetes.io/scheme: internet-facing
# Health Check Settings
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
alb.ingress.kubernetes.io/target-type: instance
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
alb.ingress.kubernetes.io/success-codes: '200'
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
alb.ingress.kubernetes.io/group.name: my-group
spec:
rules:
- http:
paths:
- path: /app1/*
pathType: Prefix
backend:
service:
name: user-service-app-nodeport-service
port:
number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: tenant2
name: nginx
labels:
app: nginx
annotations:
# Ingress Core Settings
kubernetes.io/ingress.class: "alb"
alb.ingress.kubernetes.io/scheme: internet-facing
# Health Check Settings
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
alb.ingress.kubernetes.io/target-type: instance
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
alb.ingress.kubernetes.io/success-codes: '200'
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
alb.ingress.kubernetes.io/group.name: my-group
spec:
rules:
- http:
paths:
- path: /app2/*
pathType: Prefix
backend:
service:
name: nginx-app-service
port:
number: 80
重新创建两个入口解决了我的问题。不要尝试修改不属于组的现有入口(通过注释明确地显示)。 在 EKS 1.25 和 aws-alb-ingress-controller v2.5.3 上测试。