Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify the `nodePort` range when using Docker Desktop?

I tried to open nodePort 80/443, but it failed because it was outside the default nodePort range.

Solution is add - --service-node-port-range option to static pod kube-apiserver-docker-desktop. But how can I modify the static pod using Docker Desktop on Windows? I tried to edit this pod directly but failed.

kubectl edit pod kube-apiserver-docker-desktop -n kube-system
like image 862
Leo Avatar asked Oct 25 '25 22:10

Leo


1 Answers

You need to run a privileged docker container :

$ docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh

Then edit kubernetes configuration here :

$ vi /etc/kubernetes/manifests/kube-apiserver.yaml

Add the command line param in the list with the ports you need:

        - --service-node-port-range=80-36000

This StackOverflow question explain how to process :

Location of Kubernetes config directory with Docker Desktop on Windows

like image 52
Gael C Avatar answered Oct 27 '25 15:10

Gael C