<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>30000-32767 is the default nodeport range in kubernetes. you have defined as, nodePort: 443. it is not supported and hence the error was thrown.</p>

<p>follow the below steps</p>

<ol>
<li>replace NodePort with ClusterIP as service type</li>
<li>deploy ingress controller</li>
<li>deploy default backend</li>
<li>create secret from dns certificates ( for https )</li>
<li>deploy Ingress Rule ( include the secrets ) to route the users request to backend service. </li>
</ol>
