开发者社区> 问答> 正文

在minikube上映射服务以托管IP

这是我第一次浏览Kubernetes教程。我在无头Ubuntu服务器(18.04)上安装了Docker,Kubectl和Minikube。我像这样跑Minikube -

minikube start --vm-driver=none
我有一个本地docker镜像在端口9110上运行一个restful服务。我创建一个部署并像这样暴露它 -

kubectl run hello-node --image=dbtemplate --port=9110 --image-pull-policy=Never
kubectl expose deployment hello-node --type=NodePort
我的服务状况 -

kubectl get services

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-node NodePort 10.98.104.45 9110:32651/TCP 39m
kubernetes ClusterIP 10.96.0.1 443/TCP 3h2m

kubectl describe services hello-node

Name: hello-node
Namespace: default
Labels: run=hello-node
Annotations:
Selector: run=hello-node
Type: NodePort
IP: 10.98.104.45
Port: 9110/TCP
TargetPort: 9110/TCP
NodePort: 32651/TCP
Endpoints: 172.17.0.5:9110
Session Affinity: None
External Traffic Policy: Cluster
Events:

minikube ip

192.168.1.216
如您所见,该服务在内部IP 172.17.0.5上可用。

有没有办法让我将此服务映射到/暴露在父主机的IP上,即192.168.1.216。

展开
收起
k8s小能手 2019-01-11 13:43:10 4836 0
1 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
多租户Kubernetes实践:从容器运行时到SDN 立即下载
多租户Kubernetes实践-从容器运行时到SDN 立即下载
《容器网络文件系统CNFS》 立即下载