Minikube and non-default NodePorts

9/4/2018

I'm trying to start my dockerized application in a pod with a StatefulSet. The application uses around 20 ports, that are known by other services, so I'd like to expose them on the same port number as before the docker/k8s. For this I added port mappings in the service.yaml file like this:

- port: 8080
  targetPort: 8080
  nodePort: 8080
  protocol: TCP
  name: serverpool1
- port: 8081
  targetPort: 8081
  nodePort: 8081
  protocol: TCP
  name: serverpool2

To make this work I need to be able to use nodePorts not in the default range. For what I have seen it should work like this:

minikube start --extra-config=apiserver.ServiceNodePortRange=5000-46000

The issue is that if I have the --extra-config param, the minikube does not start, but gives an error:

Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...

E0904 09:18:24.862606   28110 start.go:305] Error restarting cluster:  restarting kube-proxy: waiting for kube-proxy to be up for configmap update: timed out waiting for the condition

Without the --extra-config parameter it starts normally, but I'm not able to have the lower ports.

I have a Mac with High Sierra, I use VirtualBox as VM, I have minikube version v0.28.2 and kubectl version:

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-08T16:31:10Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
-- Sven
docker
kubernetes
macos
minikube

1 Answer

9/4/2018

I think you are affected by problem described here: https://github.com/kubernetes/minikube/issues/2733 I reproduced that case on my minikube on Ubuntu 18.04 and I can confirm the same error so it looks more like problem/bug in minikube.

-- Jakub Bujny
Source: StackOverflow