Currently, my kubernetes cluster (sitting on AWS) has a simple setup with a Deployment
, which has a web container listens on 80 and 443.
The cluster also has a NodePort
service, which exposes the traffic to public on ports 30080 and 30443. I am trying to figure out a way to accept public traffic on 80 and 443.
What could be a good way to do that?
My thoughts about possible solutions:
Manually configure a ELB on AWS, which could map 80 and 443 traffic to 30080 and 30443 ports.
Use LoadBalancer
supported by kubernetes, but I have some issues of integrating my cluster with AWS described here. I'd rather try other possible solutions than being stuck on this one.
I've seen many posts talking about Ingress
service, but various posts have totally different setup. I wonder what could be a good use case for Ingress
in my setup. Is Ingress
supposed to replace my NodePort
service in my case?
Thanks
As soon as the NodePort service is bound to specified ports on all cluster nodes, you just need to deliver traffic to any of these nodes, or to all of them. Sometimes it could lead to additional delay, but from the connectivity perspective, it should work fine.
You can configure Load Balancer manually, then add all cluster nodes to its pool and configure health checks for them to exclude a node from the pool when a particular node fails.
Ingress actually works in a similar way. All traffic that comes to a specific port of any node is forwarded to the Ingress pod. Ingress controller looks for created Ingress objects and configures the Ingress pod according to the specifications in these objects. Actually, Ingress controller and Ingress pod in my example are the same thing.
Ingress can provide additional logic for managing the traffic on the HTTP level, like path based routing, adjusting the request before sending it to the service, serving like SSL endpoint, etc.
But anyway, you should deliver external traffic to the nodes somehow. At this point, we are returning to the Load Balancer configuration.
In some cases, when your cluster is deployed on the cloud that provides Load Balancer service, Ingress controller takes care about creating cloud Load Balancer also.
Did you use kops to deploy your Kubernetes cluster on AWS?
Usually, kops create a cluster that integrates with AWS without any problems, so you can use the LoadBalancer type of Service. Doing everything manually you can make small configuration mistake that would be hard to find and correct.
Please check out the very good article:
How to create Ingress on AWS: