Kubernetes Load balancer without Label Selector

6/4/2019

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

-- shrimpy
amazon-eks
aws-eks
eks
kubernetes

2 Answers

6/4/2019

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?

-- Darren Reddick
Source: StackOverflow

6/5/2019

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

-- Fei
Source: StackOverflow