AWS ALB Service在Kubernetes

发布于 2025-01-19 15:13:10 字数 834 浏览 3 评论 0原文

我想为在 Kubernetes 中运行的 Traefik 部署应用程序负载均衡器。因此,我尝试了以下操作:

kind: Service
apiVersion: v1
metadata:
  name: traefik-application-elb
  namespace: kube-system
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
    service.beta.kubernetes.io/aws-load-balancer-type: "elb"
    service.beta.kubernetes.io/aws-load-balancer-name: "eks-traefik-application-elb"
    service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "App=traefik,Env=dev"
spec:
  type: LoadBalancer
  ports:
    - protocol: TCP
      name: web
      port: 80
    - protocol: TCP
      name: websecure
      port: 443
  selector:
    app: traefik

但是创建了面向互联网的 Classic 负载均衡器。 还尝试了 service.beta.kubernetes.io/aws-load-balancer-type: "alb" 但没有任何改变。

这里出了什么问题?

I want to deploy Application Load Balancer for Traefik running in Kubernetes. So, I tried the following:

kind: Service
apiVersion: v1
metadata:
  name: traefik-application-elb
  namespace: kube-system
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
    service.beta.kubernetes.io/aws-load-balancer-type: "elb"
    service.beta.kubernetes.io/aws-load-balancer-name: "eks-traefik-application-elb"
    service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "App=traefik,Env=dev"
spec:
  type: LoadBalancer
  ports:
    - protocol: TCP
      name: web
      port: 80
    - protocol: TCP
      name: websecure
      port: 443
  selector:
    app: traefik

But internet-facing Classic load balancer was created.
Also tried service.beta.kubernetes.io/aws-load-balancer-type: "alb" but nothing changed.

What is wrong here ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木有鱼丸 2025-01-26 15:13:10

从文档中: https://docs.aws。 Amazon.com/eks/latest/userguide/network-load-balancing.html

当您创建类型LoadBalancer的Kubernetes服务时,AWS Cloud Provider Load Balancer Controller默认会创建AWS经典负载平衡器,但也可以创建AWS Network Load Load Balancers。

ALB不受K8S负载平衡器的支持。您可以根据需要指定NLB。

但是,您可以将ALB用作带有这样的部署的入口控制器 - https://aws.amazon.com/blogs/containers/introducing-aws-load-balancer-controller/

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: SearchApp
  annotations:
    # share a single ALB with all ingress rules with search-app-ingress
    alb.ingress.kubernetes.io/group.name: search-app-ingress
spec:
  defaultBackend:
    service:
      name: search-svc # route traffic to the service search-svc
      port:
        number: 80

From the docs: https://docs.aws.amazon.com/eks/latest/userguide/network-load-balancing.html

When you create a Kubernetes Service of type LoadBalancer, the AWS cloud provider load balancer controller creates AWS Classic Load Balancers by default, but can also create AWS Network Load Balancers.

ALB is not supported as a k8s load balancer. You can specify an NLB if desired.

However you can use ALB as an ingress controller with a deployment like this - https://aws.amazon.com/blogs/containers/introducing-aws-load-balancer-controller/

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: SearchApp
  annotations:
    # share a single ALB with all ingress rules with search-app-ingress
    alb.ingress.kubernetes.io/group.name: search-app-ingress
spec:
  defaultBackend:
    service:
      name: search-svc # route traffic to the service search-svc
      port:
        number: 80

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文