Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCE LoadBalancer : Invalid value for field 'namedPorts[0].port': '0'. Must be greater than or equal to 1

In one of my HTTP(S) LoadBalancer, I wish to change my backend configuration to increase the timeout from 30s to 60s (We have a few 502's that do not have any logs server-side, I wish to check if it comes from the LB)

But, as I validate the change, I got an error saying

Invalid value for field 'namedPorts[0].port': '0'. Must be greater than or equal to 1

even if i didn't change the namedPort.

This issue seems to be the same, but the only solution is a workaround that does not work in my case :

Thanks for your help,

like image 804
Simon Lacoste Avatar asked Aug 17 '17 14:08

Simon Lacoste


People also ask

What is Type NodePort or LoadBalancer?

The NodePort type is an extension of the ClusterIP type. So a Service of type NodePort has a cluster IP address. The LoadBalancer type is an extension of the NodePort type. So a Service of type LoadBalancer has a cluster IP address and one or more nodePort values.

What is LoadBalancer ingress?

Ingress Load Balancer Kubernetes DefinitionAn external load balancer routes external traffic to a Kubernetes service in your cluster and is associated with a specific IP address. Its precise implementation is controlled by which service types the cloud provider supports.

What is backend in load balancer?

A backend service defines how Cloud Load Balancing distributes traffic. The backend service configuration contains a set of values, such as the protocol used to connect to backends, various distribution and session settings, health checks, and timeouts.


2 Answers

I faced the same issue and @tmirks 's fix didn't work for me.

After experimenting with GCE for a while, I realised that the issue is with the service.

By default all services are type: ClusterIP unless you specified otherwise.

Long story short, if your service isn't exposed as type: NodePort than the GCE load balancer won't route the traffic to it.

From the official Kubernetes project:

nodeport is a requirement of the GCE Ingress controller (and cloud controllers in general). "On-prem" controllers like the nginx ingress controllers work with clusterip:

like image 182
danielepolencic Avatar answered Oct 22 '22 14:10

danielepolencic


I'm sure the OP has resolved this by now, but for anyone else pulling their hair out, this might work for you:

There's a bug of sorts in the GCE Load Balancer UI. If you add an empty frontend IP/Port combo by accident, it will create a named port in the Instance Group called port0 with a value of 0. You may not even realize this happened because you won't see the empty frontend mapping in the console.

To fix the problem, edit your instance group and remove port0 from the list of port name mappings.

Instance Group -> Details -> Port name mapping

like image 11
tmirks Avatar answered Oct 22 '22 14:10

tmirks