3 - 端口需求


注意 端口需求具体以英文文档为准。

要保证Rancher正常运行,需要主机或者安全策略打开以下端口。使用云服务创建集群(如Amazon EC2或DigitalOcean),Rancher会自动打开这些端口。下图显示了Rancher的基本端口要求。如果需要了解更多,请查阅下表。

Basic port Requirements

Rancher节点

The following table lists the ports that need to be open to and from nodes that are running the Rancher server container for single node installs or pods for high availability installs.

ProtocolPortSourceDestinationDescription
TCP80Load Balancer / Reverse ProxyHTTP traffic to Rancher UI / API.
TCP443Load Balancer / Reverse ProxyOtherwise IPs of all cluster nodes and other Rancher API / UI clients.HTTPS traffic to Rancher UI / API.
TCP44335.160.43.14535.167.242.4652.33.59.17Rancher catalog (git.rancher.io).
TCP22Any node created using node driver.SSH provisioning of node by node driver.
TCP2376Any node created using node driver.Docker daemon TLS port used by node driver.
TCPProvider DependentPort of the Kubernetes API endpoint in hosted clusters.Kubernetes API.

Kubernetes集群节点

The ports required to be open for cluster nodes changes depending on how the cluster was launched. Each of the tabs below list the ports that need to be opened for different cluster creation options.

Tip:

If security isn’t a large concern and you’re okay with opening a few additional ports, you can use the table in Commonly Used Ports as your port reference instead of the comprehensive tables below.

The following table depicts the port requirements for Rancher Launched Kubernetes with nodes created in an Infrastructure Provider.

Note:The required ports are automatically opened by Rancher during creation of clusters in cloud providers like Amazon EC2 or DigitalOcean.

From / ToRancher Nodesetcd Plane NodesControl Plane NodesWorker Plane NodesExternal Load BalancerInternet
Rancher Nodes (1)22 TCPgit.rancher.io (2):35.160.43.145:3235.167.242.46:3252.33.59.17:32
2376 TCP
etcd Plane Nodes443 TCP (3)2379 TCP443 TCP
2380 TCP
6443 TCP
8472 UDP
9099 TCP (4)
Control Plane Nodes443 TCP (3)2379 TCP443 TCP
2380 TCP
6443 TCP
8472 UDP
10250 TCP
9099 TCP (4)
10254 TCP (4)
Worker Plane Nodes443 TCP (3)6443 TCP443 TCP
8472 UDP
9099 TCP (4)
10254 TCP (4)
External Load Balancer (5)80 TCP
443 TCP (6)
API / UI Clients80 TCP (3)80 TCP
443 TCP (3)443 TCP
Workload Clients30000-32767 TCP / UDP(nodeport)
80 TCP (Ingress)
443 TCP (Ingress)
Notes:1. Nodes running standalone server or Rancher HA deployment.2. Required to fetch Rancher chart library.3. Only without external load balancer.4. Local traffic to the node itself (not across nodes).5. Load balancer / proxy that handles tragging to the Rancher UI / API.6. Only if SSL is not terminated at external load balancer.

The following table depicts the port requirements for Rancher Launched Kubernetes with Custom Nodes.

From / ToRancher Nodesetcd Plane NodesControl Plane NodesWorker Plane NodesExternal Load BalancerInternet
Rancher Nodes (1)git.rancher.io (2):35.160.43.145:3235.167.242.46:3252.33.59.17:32
etcd Plane Nodes443 TCP (3)2379 TCP443 TCP
2380 TCP
6443 TCP
8472 UDP
4789 UDP (7)
9099 TCP (4)
Control Plane Nodes443 TCP (3)2379 TCP443 TCP
2380 TCP
6443 TCP
8472 UDP
4789 UDP (7)
10250 TCP
9099 TCP (4)
10254 TCP (4)
Worker Plane Nodes443 TCP (3)6443 TCP443 TCP
8472 UDP
4789 UDP (7)
9099 TCP (4)
10254 TCP (4)
External Load Balancer (5)80 TCP
443 TCP (6)
API / UI Clients80 TCP (3)80 TCP
443 TCP (3)443 TCP
Workload Clients30000-32767 TCP / UDP(nodeport)
80 TCP (Ingress)
443 TCP (Ingress)
Notes:1. Nodes running standalone server or Rancher HA deployment.2. Required to fetch Rancher chart library.3. Only without external load balancer.4. Local traffic to the node itself (not across nodes).5. Load balancer / proxy that handles tragging to the Rancher UI / API.6. Only if SSL is not terminated at external load balancer.7. Only if using Overlay mode on Windows cluster.

The following table depicts the port requirements for hosted clusters.

From / ToRancher NodesHosted / Imported ClusterExternal Load BalancerInternet
Rancher Nodes (1)Kubernetes API Endpoint Port (2)git.rancher.io (3):35.160.43.145:3235.167.242.46:3252.33.59.17:32
Hosted / Imported Cluster443 TCP (4)(5)443 TCP (5)
External Load Balancer (5)80 TCP443 TCP (6)
API / UI Clients80 TCP (4)443 TCP (4)80 TCP443 TCP
Workload ClientCluster / Provider Specific (7)
Notes:1. Nodes running standalone server or Rancher HA deployment.2. Only for hosted clusters.3. Required to fetch Rancher chart library.4. Only without external load balancer.5. From worker nodes.6. Only if SSL is not terminated at external load balancer.7. Usually Ingress backed by infrastructure load balancer and/or nodeport.

The following table depicts the port requirements for imported clusters.

From / ToRancher NodesHosted / Imported ClusterExternal Load BalancerInternet
Rancher Nodes (1)Kubernetes API Endpoint Port (2)git.rancher.io (3):35.160.43.145:3235.167.242.46:3252.33.59.17:32
Hosted / Imported Cluster443 TCP (4)(5)443 TCP (5)
External Load Balancer (5)80 TCP443 TCP (6)
API / UI Clients80 TCP (4)443 TCP (4)80 TCP443 TCP
Workload ClientCluster / Provider Specific (7)
Notes:1. Nodes running standalone server or Rancher HA deployment.2. Only for hosted clusters.3. Required to fetch Rancher chart library.4. Only without external load balancer.5. From worker nodes.6. Only if SSL is not terminated at external load balancer.7. Usually Ingress backed by infrastructure load balancer and/or nodeport.

其他端口注意事项

常用端口

这些端口通常需要在Kubernetes节点上打开,而不管它是什么类型的集群。

ProtocolPortDescription
TCP22Node driver SSH provisioning
TCP2376Node driver Docker daemon TLS port
TCP2379etcd client requests
TCP2380etcd peer communication
UDP8472Canal/Flannel VXLAN overlay networking
TCP9099Canal/Flannel livenessProbe/readinessProbe
TCP10250kubelet API
TCP10254Ingress controller livenessProbe/readinessProbe
TCP/UDP30000-32767NodePort port range

本地节点流量

标记为local traffic的端口(即在上述要求中,Kubernetes healthchecking (livenessProbe andreadinessProbe)使用。这些healthcheck是在节点本身上执行的。在大多数云环境中,默认情况下允许本地通信。

然而,当以下情况出现时,该流量可能会被阻塞:

  • 节点上应用了严格的主机防火墙策略。
  • 节点具有多个接口(multihomed)。在这些情况下,您必须在您的主机防火墙中允许这类流量,或者在您的安全组配置中,在公共/私有云托管主机(如AWS或OpenStack)中允许这类流量。

Rancher AWS EC2安全组

使用AWS EC2 node driver提供Rancher中的集群节点,您可以选择让Rancher创建一个名为rancher-nodes的安全组,以下规则将自动添加到此安全组。

TypeProtocolPort RangeSource/DestinationRule Type
SSHTCP220.0.0.0/0Inbound
HTTPTCP800.0.0.0/0Inbound
Custom TCP RuleTCP4430.0.0.0/0Inbound
Custom TCP RuleTCP23760.0.0.0/0Inbound
Custom TCP RuleTCP2379-2380sg-xxx (rancher-nodes)Inbound
Custom UDP RuleUDP4789sg-xxx (rancher-nodes)Inbound
Custom TCP RuleTCP64430.0.0.0/0Inbound
Custom UDP RuleUDP8472sg-xxx (rancher-nodes)Inbound
Custom TCP RuleTCP10250-10252sg-xxx (rancher-nodes)Inbound
Custom TCP RuleTCP10256sg-xxx (rancher-nodes)Inbound
Custom TCP RuleTCP30000-3276730000-32767Inbound
Custom UDP RuleUDP30000-3276730000-32767Inbound
All trafficAllAll0.0.0.0/0Outbound