代码之家  ›  专栏  ›  技术社区  ›  mon

Kubernetes中etcd的连接被拒绝

  •  0
  • mon  · 技术社区  · 8 年前

    问题

    Kubernetes的etcd拒绝连接,只接受本地连接的原因是出于安全考虑?

    主节点

    $ sudo netstat -tnlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 127.0.0.1:2379          0.0.0.0:*               LISTEN      386/etcd            
    tcp        0      0 127.0.0.1:2380          0.0.0.0:*               LISTEN      386/etcd            
    
    $ hostname
    master
    
    $ ping master
    PING master (192.168.99.10) 56(84) bytes of data.
    64 bytes from master (192.168.99.10): icmp_seq=1 ttl=64 time=0.028 ms
    64 bytes from master (192.168.99.10): icmp_seq=2 ttl=64 time=0.059 ms
    ^C
    
    $ curl -iv  http://master:2379/health
    curl: (7) Failed connect to master:2379; Connection refused
    
    $ curl -s http://localhost:2379/health | python -m json.tool
    {
        "health": "true"
    }
    

    工作节点

    $ curl -iv http://192.168.99.10:2379/health
    * Failed connect to 192.168.99.10:2379; Connection refused
    
    1 回复  |  直到 8 年前
        1
  •  2
  •   Suresh Vishnoi    8 年前

    根据设计,只有kube api服务器能够访问ectd服务器。Kube api服务器可以更改集群的状态,因为etcd在kubernertes集群中被称为真理之源。

    每个对etcd服务器的请求都经过身份验证、授权、验证,并转换为etcd模式,以实现稳定性、可靠性和安全性。

    因此,最好直接将请求发送到kube api服务器,该服务器将为您完成上述所有功能。

    您可以使用与etcd服务器通信 etcdctl公司 也它用于检查群集运行状况以及生成数据库快照。例如

    etcdctl cluster-health 
    
    推荐文章