I already had NGINX handling my reverse-proxy and load balancing for bare-metals and VMs, wonder if I can use the same instance for my Kubernetes cluster exposing services in load-balancer mode. If so, could I use it for both L4 and L7?
You can't use it as type LoadBalancer
because there's no cloud-provider
API to handle an external Nginx instance. You can do a couple of things I can think of:
Create Kubernetes Service exposed on a NodePort
. So your architecture will look like this:
External NGINX -> Kubernetes NodePort Service -> Pods
Create a Kubernetes Ingress managed by an ingress controller. The most popular happens to be Nginx. So your architecture will look something like this:
External NGINX -> Kubernetes Service (has to be NodePort) -> Ingress (NGINX) -> Backend Service -> Pods