<p>I'm porting my dockerized app to kubernetes and I'm facing an issue creating a load balancer with aks:</p>

<pre><code>The Service "lbalance" is invalid: spec.ports[0].nodePort: Invalid value: 80: provided port is not in the valid range. 
The range of valid ports is 30000-32767
</code></pre>

<p>the configuration is pretty straightforward</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: lbalance
spec:
  selector:
    app: lbalance
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 80
    name: http
  - protocol: TCP
    port: 443
    targetPort: 443
    nodePort: 443
    name: https
  type: LoadBalancer
</code></pre>

<p>Behind that sits an haproxy with ssl termination toward the other services exposed within the cluster</p>

<p>In my testing environment I had a property to control which port to open ( --service-node-port-range ) but I cannot find that property neither on the portal page nor on the Azure documentation.</p>

<p>Is there a way to have a service on default ports or a recommended way to connect back to that Endpoint ports?</p>

<p>you need to remove the <code>nodePort</code> declaration from your yaml and it will get allocated by kubernetes from the pool mentioned in the error text (the only one you can use).</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: lbalance
spec:
  selector:
    app: lbalance
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    name: http
  - protocol: TCP
    port: 443
    targetPort: 443
    name: https
  type: LoadBalancer
</code></pre>

<p>this way your service would be available on 80\443 and thing will work like they should</p>
