<p>I want to create a loadBalancer service on kubernetes that exposes a large range of ports. As you can't do that on kubernetes yet (<a href="https://github.com/kubernetes/kubernetes/issues/23864" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/23864</a>).</p>

<p>I have manually entered a range of port by having a yaml file in the following format:</p>

<pre><code>apiVersion: v1
kind: Service
metadata: 
  name: service
spec:
  ports:
  - name: port10000
  port: 10000
  protocol: UDP
    .
    .
    .
  - name: port40000
  port: 40000
  protocol: UDP
  selector: 
    app: app-label
  type: LoadBalancer    
</code></pre>

<p>I get the following error:</p>

<blockquote>
  <p>Error from server (InternalError): error when creating "service-udp.yml": Internal error occurred: failed to allocate a nodePort: range is full</p>
</blockquote>

<p>Is it possible to increase the range of ports available for a service? And if so, how?</p>

<p>This is controlled by the <code>--service-node-port-range portRange</code> argument to <code>kube-apiserver</code> - the way to change that depends on your environment.</p>

<p>Keep in mind that nodePorts are meant to be used by load balancers as building blocks. So what you are trying to do is most likely not the best practice.</p>

<p>Hope this helps..</p>
