Minikube和非默认NodePort

时间:2018-09-04 07:03:51

标签: macos docker kubernetes minikube

我正在尝试使用StatefulSet在pod中启动我的dockerized应用程序。该应用程序使用20 ports左右,这是其他服务已知的,因此我想将它们公开在与docker / k8s之前相同的端口号上。为此,我在service.yaml文件中添加了端口映射,如下所示:

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

要执行此操作,我需要能够使用不在默认范围内的nodePorts。对于我所看到的,它应该像这样工作:

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

问题是,如果我有--extra-config参数,则迷你库不会启动,但会出现错误:

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

没有--extra-config参数,它可以正常启动,但是我无法使用较低的端口。

我有一台具有High Sierra的Mac,我将VirtualBox用作VM,我有minikube version v0.28.2和kubectl版本:

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

1 个答案:

答案 0 :(得分:2)

我认为您受到以下问题的影响:https://github.com/kubernetes/minikube/issues/2733我在Ubuntu 18.04的minikube上重现了这种情况,我可以确认相同的错误,因此看起来更像minikube中的问题/错误。