Kubernetes Load balancer without Label Selector

孤者浪人 提交于 2019-12-11 17:26:45

问题


Trying to create a Laod Balancer resource with Kubernetes (for an EKS cluster). It works normally with the Label Selector, but we want to only have one LB per cluster, then let ingress direct services. Here is what I currently have :

kind: Service
apiVersion: v1
metadata:
  namespace: default
  name: name
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
spec:
  ports:
  - port: 80
  type: LoadBalancer

This creates a LB and gives it an internal DNS, but instances never get healthy (although they are).

Any advices


回答1:


What does the monitoring page for the LB target group show for the failures? Are there HTTP error responses or just connection errors? Is the security group for the K8S nodes set up to allow ingress from the LB?




回答2:


Per discussion in another question you posted. I think what you want is to achieve One Load Balancer Per Cluster, referring to this: Save on your AWS bill with Kubernetes Ingress.

To achieve this, you would need to create:

  1. A Load Balancer Service with Nginx-Ingress-Controller pod as backend.
  2. Your Load balancer Service would have an External IP, point all your cluster traffic to that IP.
  3. Ingress rules that route all cluster traffic as you wish.

So your traffic would go through the following pipeline:

all traffic -> AWS LoadBalancer -> Node1:xxxx -> Nginx-Ingress-Controller Service -> Nginx-Ingress-Controller Pod -> Your Service1 (based on your ingress rules) -> Your Pod

Here is an example how to bring up a Nginx-Ingress-Controller: https://hackernoon.com/setting-up-nginx-ingress-on-kubernetes-2b733d8d2f45



来源:https://stackoverflow.com/questions/56444546/kubernetes-load-balancer-without-label-selector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!