我在我的ubuntu 16.04机器上安装了minikube并启动了一个集群,并附带一条消息
“Kubernetes可在https://192.168.99.100:443获取”
接下来,我使用以下命令部署了Nginx服务
> kubectl.sh运行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 Nginx 10.0.0.83 Nginx
> kubectl.sh get nodes -o wide
NAME STATUS AGE
127.0.0.1 Ready 16m
问题:
1)节点127.0.0.1是我的本地开发机器吗?这让我最困惑.
2)以下理解是否正确:集群(节点,kubernetes API服务器)具有10.0.0.x中的内部IP地址,其对应的外部IP地址为192.168.99.x.那么2个pod将具有10.0.1.x和10.0.2.x范围内的IP?
3)为什么服务的外部IP不存在?对于kubernetes服务,甚至都没有.这里不是192.168.99.43的外部IP吗?
4)最重要的是,如何从笔记本电脑连接到Nginx服务?
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,而不是主机.
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是您在群集外可见的“公共”地址.
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服务类型,这意味着它只对内部集群可见.
4) Most importantly,how do I connect to the Nginx service from my
laptop?
查看Nginx服务的最简单方法是使其键入NodePort,然后部署该服务.在此之后,描述服务以获取已分配的端口(或在您创建它之后也会告诉您).然后点击您的VM的IP并提供自动分配的NodePort.
例如http://192.168.99.100:30001