<p>I have a requirement that a test server should use the port range 20000 - 22767</p>
<p>I edited the <code>kubeadm-config</code> with the command</p>
<p><code>kubectl edit cm kubeadm-config -n kube-system</code></p>
<p>When I look at the result I see that the change seems to have been stored:</p>
<p>The command <code>$ kubeadm config view</code> gives me</p>
<pre><code>apiServer:
  extraArgs:
    authorization-mode: Node,RBAC
    service-node-port-range: 20000-22767
  timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta1
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: &quot;&quot;
controllerManager: {}
dns:
  type: CoreDNS
etcd:
  local:
    dataDir: /var/lib/etcd
imageRepository: k8s.gcr.io
kind: ClusterConfiguration
kubernetesVersion: v1.13.3
networking:
  dnsDomain: cluster.local
  podSubnet: 10.244.0.0/16
  serviceSubnet: 10.96.0.0/12
scheduler: {}
</code></pre>
<p>But when I later try to install something within hte new port range I get the error</p>
<pre><code>helm upgrade --install --kubeconfig /external-storage/workspace/potapi-orchestration/clusters/at/admin.conf potapi-services charts/potapi-services -f charts/potapi-services/values.at.yaml
Error: UPGRADE FAILED: Service &quot;potapi-services&quot; is invalid: spec.ports[0].nodePort: Invalid value: 21011: provided port is not in the valid range. The range of valid ports is 30000-32767
</code></pre>
<p>I have fiddled with the suggestions here but with no luck: <a href="https://github.com/kubernetes/kubeadm/issues/122" rel="noreferrer">https://github.com/kubernetes/kubeadm/issues/122</a></p>

Thomas Sundberg
<p>It is possible to update the <code>service-node-port-range</code>from it's default values.</p>

<p>I updated the file <code>/etc/kubernetes/manifests/kube-apiserver.yaml</code> with <code>--service-node-port-range=20000-22767</code>. </p>

<p>The apiserver was restarted and the port range was updated.</p>

<p>I wrote a <a href="http://www.thinkcode.se/blog/2019/02/20/kubernetes-service-node-port-range" rel="noreferrer">blog post</a> about it.</p>
