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

Viewed 513

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
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

Related