Minikube 和非默认 NodePorts
Minikube and non-default NodePorts
我正在尝试在带有 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
为了完成这项工作,我需要能够使用不在默认范围内的节点端口。对于我所看到的,它应该像这样工作:
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"}
我认为您受到此处描述的问题的影响:https://github.com/kubernetes/minikube/issues/2733 我在 Ubuntu 18.04 上在我的 minikube 上重现了那个案例,我可以确认同样的错误所以它看起来更像 problem/bug 在 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
为了完成这项工作,我需要能够使用不在默认范围内的节点端口。对于我所看到的,它应该像这样工作:
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"}
我认为您受到此处描述的问题的影响:https://github.com/kubernetes/minikube/issues/2733 我在 Ubuntu 18.04 上在我的 minikube 上重现了那个案例,我可以确认同样的错误所以它看起来更像 problem/bug 在 minikube 中。