minikube:无法连接本地部署的nginx服务 [英] minikube : not able to connect a locally deployed nginx service

查看:403
本文介绍了minikube:无法连接本地部署的nginx服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu 16.04机器上安装了minikube并启动了集群,并显示一条消息

I have installed minikube on my ubuntu 16.04 machine and have started a cluster, with a message

"Kubernetes is available at https://192.168.99.100:443"

接下来,我使用以下命令部署nginx服务

Next, I deployed nginx service with the following command

> kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80 --expose

> kubectl.sh get  pods -o wide
NAME                        READY     STATUS    RESTARTS   AGE       NODE
my-nginx-2494149703-8jnh4   1/1       Running   0          13m       127.0.0.1
my-nginx-2494149703-q09be   1/1       Running   0          13m       127.0.0.1

> kubectl.sh get  services -o wide
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE       SELECTOR
kubernetes   10.0.0.1     <none>        443/TCP   14m       <none>
my-nginx     10.0.0.83    <none>        80/TCP    13m       run=my-nginx

> kubectl.sh get  nodes -o wide
NAME        STATUS    AGE
127.0.0.1   Ready     16m

问题:

1)节点127.0.0.1是我的本地开发机器吗?这让我最困惑.

1) Is node 127.0.0.1 my local development machine? This has got me confused me the most.

2)我的以下理解正确吗:群集(节点,kubernetes API服务器)的内部IP地址为10.0.0.x,其对应的外部IP地址为192.168.99.x.然后,这两个Pod的IP范围在10.0.1.x和10.0.2.x之间?

2) Is my following understanding correct: The cluster (nodes, kubernetes API server) has internal IP addresses in 10.0.0.x and their corresponding external IP addresses are 192.168.99.x. The 2 pods will then have IPs in the range like 10.0.1.x and 10.0.2.x ?

3)为什么服务的外部IP不存在?甚至不,对于kubernetes服务. 192.168.99.43不是这里的外部IP吗?

3) Why is the external IP for the services not there? Not even, for the kubernetes service. Isn't the 192.168.99.43 an external IP here?

4)最重要的是,如何从笔记本电脑连接到nginx服务?

4) Most importantly, how do I connect to the nginx service from my laptop?

推荐答案

1)节点127.0.0.1是我的本地开发机器吗?这让我 最让我感到困惑.

1) Is node 127.0.0.1 my local development machine? This has got me confused me the most.

当节点注册时,您提供要注册的IP或名称.默认情况下,该节点仅注册127.0.0.1.这是指您的运行Linux的VM,而不是您的主机.

When a node registers, you provide the IP or name to register with. By default, the node is just registering 127.0.0.1. This is referencing your VM running linux, not your host machine.

2)我的以下理解正确吗:群集(节点, kubernetes API服务器)在10.0.0.x中具有内部IP地址, 相应的外部IP地址为192.168.99.x. 2个豆荚将 那么IP的范围在10.0.1.x和10.0.2.x之间?

2) Is my following understanding correct: The cluster (nodes, kubernetes API server) has internal IP addresses in 10.0.0.x and their corresponding external IP addresses are 192.168.99.x. The 2 pods will then have IPs in the range like 10.0.1.x and 10.0.2.x ?

是的,10.0.0.x网络是您的覆盖网络. 192.168.99.x是您的公共"地址,在群集外部可见.

Yup, the 10.0.0.x network is your overlay network. The 192.168.99.x are your "public" addresses which are visible outside of the cluster.

3)为什么服务的外部IP不存在?甚至不,因为 kubernetes服务. 192.168.99.43不是这里的外部IP吗?

3) Why is the external IP for the services not there? Not even, for the kubernetes service. Isn't the 192.168.99.43 an external IP here?

外部IP通常用于通过特定IP进入流量. kubernetes服务正在使用clusterIP服务类型,这意味着它仅对内部集群可见.

The external IP is typically used to ingress traffic via a specific IP. The kubernetes service is using a clusterIP service type which means it's only visible to the internal cluster.

4)最重要的是,如何从我的设备连接到Nginx服务 笔记本电脑?

4) Most importantly, how do I connect to the nginx service from my laptop?

查看nginx服务的最简单方法是使其键入NodePort,然后部署该服务.之后,描述服务以获取分配的端口(或者在创建后也将告诉您).然后点击您的VM的IP,并提供自动分配的NodePort.

The easiest way to view your nginx service is to make it type NodePort, then deploy the service. After that, describe the service to get the port that was assigned (or after you create it will tell you as well). Then hit the ip of your VM and provide the auto assigned NodePort.

e.g. http://192.168.99.100:30001

e.g. http://192.168.99.100:30001

这篇关于minikube:无法连接本地部署的nginx服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆