【发布时间】:2019-02-09 03:37:43
【问题描述】:
我正在尝试在带有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 参数,minikube 不会启动,但会报错:
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"}
【问题讨论】:
标签: macos docker kubernetes minikube