I exposed a service with a static IP and an Ingress through an nginx controller as one of the examples of the kubernetes/ingress repository. I have a second LoadBalancer service, that is not managed by any Ingress resource that is no longer properly exposed after the adding the new resources for the first service (I do not understand why this is the case).
I tried to add a second Ingress and LoadBalancer service to assign the second static IP, but I cant get it to work.
How would I go about exposing the second service, preferably with an Ingress? Do I need to add a second Ingress resource or do I have to reconfigure the one I already have?
Combining multiple Ingress resources into a single Google Cloud load balancer is not supported.
You may deploy any number of ingress controllers using ingress class within a cluster. Note the .metadata.name of your ingress class resource.
Kubernetes ingress resources are used to configure the ingress rules and routes for individual Kubernetes services. When you use an ingress controller and ingress rules, a single IP address can be used to route traffic to multiple services in a Kubernetes cluster.
Ingress controllers only cover L7 traffic, while ingresses route HTTP and HTTPS traffic. It is not possible to route TCP and UDP traffic using an Ingress, even if the ingress controller supports L4 traffic.
Using a Service
with type: LoadBalancer
and using an Ingress
are usually mutually exclusive ways to expose your application.
When you create a Service
with type: LoadBalancer
, Kubernetes creates a LoadBalancer in your cloud account that has an IP, opens the ports on that LoadBalancer that match your Service
, and then directs all traffic to that IP to the 1 Service
. So if you have 2 Service
objects, each with 'type: LoadBalancer' for 2 different Deployment
s, then you have 2 IPs as well (one for each Service
).
The Ingress
model is based on directing traffic through a single Ingress Controller which is running something like nginx. As the Ingress
resources are added, the Ingress Controller reconfigures nginx to include the new Ingress
details. In this case, there will be a Service
for the Ingress Controller (e.g. nginx) that is type: LoadBalancer
, but all of the services that the Ingress
resources point to should be type: ClusterIP
. Traffic for all the Ingress
objects will flow through the same public IP of the LoadBalancer for the Ingress Controller Service
to the Ingress Controller (e.g. nginx) Pod
s. The configuration details from the Ingress
object (e.g. virtual host or port or route) will then determine which Service
will get the traffic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With