EKS in private Subnet , Load Balancer in public su

2020-07-06 01:55发布

问题:

I am running EKS in private subnet and thus unable to create an internet facing load balancer but was able to create Internal LoadBalancer.

Is there any way I can create Loadbalancer(probably Manually) in public subnet and point to the pods running in EKS in the private subnet.

I was thinking of creating the chain of load balancer in which External load balancer will point to internal load balancer but that too is not possible as the IP address of the internal load balancer is reserved IP.

Can I try some other way to route the traffic from the internet to pod?

回答1:

I had the same issue and it was because I did not tag the VPC subnets properly: https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html

I had to add the key: kubernetes.io/cluster/{eks-cluster-name} value: shared tag to the VPC

Then you can create a LB using a service with the type LoadBalancer

apiVersion: v1
kind: Service
metadata:
  name: helloworld
  labels:
    app: helloworld
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: helloworld
  type: LoadBalancer

This might help during the service creation: https://blog.giantswarm.io/load-balancer-service-use-cases-on-aws/