问题
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:
- A
Load Balancer Service
withNginx-Ingress-Controller
pod as backend. - Your
Load balancer Service
would have an External IP, point all your cluster traffic to that IP. - 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