Kubernetes集群|无法使用主节点启动应用程序

时间:2019-05-05 06:27:40

标签: azure kubernetes azure-kubernetes

我在Microsoft Azure上有两个虚拟机(Linux-Ubuntu),一个作为主节点,另一个作为工作节点。在我的kubernetes集群中,我部署了已分配给工作节点的Nginx服务器。

问题是我可以使用以下命令访问工作节点ip上的Nginx服务器: curl ip_address_of_Nginx_pod ,但是当我尝试在主节点上运行相同的命令时,此命令将无法正常工作。

我认为入站规则存在一些问题。但是,我已经允许主节点和辅助节点上的所有流量。

在主节点上:

一旦我运行 Command :kubectl即可获得豆荚

NAME         READY   STATUS    RESTARTS   AGE   IP            NODE              
myfirstpod   1/1     Running   1          23h   192.168.2.10   demo-my-worker 

一旦我运行 Command :curl 192.168.2.10,它不会显示任何内容...

root@Demo-my-master:~/demo# curl 192.168.2.10

在工作节点上:

一旦我运行 Command :curl 192.168.2.10,它运行得很好。

root@Demo-my-worker:~/demo# curl 192.168.2.10


<head>
<title>Welcome to nginx!</title>
<style>
body {
    width: 35em;
    margin: 0 auto;
    font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed 
and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

可以请人帮忙,让我知道为什么我无法在主节点上获得相同的结果吗?

我用来创建Pod的

yaml文件包含一个简单的Nginx服务器:

apiVersion: v1
kind: Pod
metadata:
  name: myfirstpod
  labels:
    app: nginx
spec:
  containers:
    - name: nginx
      image: nginx:latest

0 个答案:

没有答案