docker - 在 Rancher/Kubernates (RKE) 中为 internal_address 打开端口?
问题描述
我有以下配置来使用Rancher (RKE)设置集群。
牧场主-config.yml
nodes:
- address: 192.168.88.204
internal_address: 172.16.22.12
user: dockeruser
role: [controlplane,worker,etcd]
- address: 192.168.88.203
internal_address: 172.16.32.37
user: dockeruser
role: [controlplane,worker,etcd]
- address: 192.168.88.202
internal_address: 172.16.42.73
user: dockeruser
role: [controlplane,worker,etcd]
services:
etcd:
snapshot: true
creation: 6h
retention: 24h
根据Rancher Networking,我已经为所有节点(192.168.88.204、192.168.88.203、192.168.88.202)打开了以下端口作为防火墙服务。
节点防火墙.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<port port="2376" protocol="tcp"/>
<port port="2379" protocol="tcp"/>
<port port="2380" protocol="tcp"/>
<port port="8472" protocol="udp"/>
<port port="9099" protocol="tcp"/>
<port port="10250" protocol="tcp"/>
<port port="443" protocol="tcp"/>
<port port="6443" protocol="tcp"/>
<port port="8472" protocol="udp"/>
<port port="6443" protocol="tcp"/>
<port port="10254" protocol="tcp"/>
<port port="30000-32767" protocol="tcp"/>
</service>
-> commmend
firewall-offline-cmd --new-service-from-file=node-firewall.xml --name=node-firewall
firewall-cmd --reload
firewall-cmd --add-service node-firewall
我的 RKE 安装在 192.168.88.151 上。对于 RKE ->
rancher-firewall.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<port port="80" protocol="tcp"/>
<port port="433" protocol="tcp"/>
<port port="22" protocol="tcp"/>
<port port="2376" protocol="tcp"/>
<port port="6443" protocol="tcp"/>
</service>
firewall-offline-cmd --new-service-from-file=rancher-firewall.xml --name=rancher-firewall
firewall-cmd --reload
firewall-cmd --add-service rancher-firewall
所以,我运行以下推荐来提升我的RKE
rke up --config ./rancher-config.yml
日志是
[root@localhost ~]# rke up --config ./rancher-config.yml
INFO[0000] Building Kubernetes cluster
INFO[0000] [dialer] Setup tunnel for host [192.168.88.204]
INFO[0000] [dialer] Setup tunnel for host [192.168.88.203]
INFO[0000] [dialer] Setup tunnel for host [192.168.88.202]
INFO[0001] [network] Deploying port listener containers
INFO[0001] [network] Port listener containers deployed successfully
INFO[0001] [network] Running etcd <-> etcd port checks
INFO[0001] [network] Successfully started [rke-port-checker] container on host [192.168.88.202]
INFO[0001] [network] Successfully started [rke-port-checker] container on host [192.168.88.204]
INFO[0001] [network] Successfully started [rke-port-checker] container on host [192.168.88.203]
FATA[0016] [network] Host [192.168.88.202] is not able to connect to the following ports:
[172.16.22.12:2379, 172.16.22.12:2380, 172.16.32.37:2379, 172.16.32.37:2380, 172.16.42.73:2380, 172.16.42.73:2379].
Please check network policies and firewall rules
我的问题是如何为集群internal_address
中的所有节点打开端口?kubernates
解决方案
可能是我的经验不足。我只是分享我发现的东西。
internal_address
必须是 (网关)的 IP 地址docker
。了解每个节点的 docker ip-address (192.168.88.204, 192.168.88.203, 192.168.88.202)。
运行推荐docker network ls
。您可能会得到以下网络信息。
NETWORK ID NAME DRIVER SCOPE
aa13d08f2676 bridge bridge local
02eabe818790 host host local
1e5bb430d790 none null local
并运行docker network inspect bridge
命令以获取bridge
. 您将获得以下类似信息。
[
{
"Name": "bridge",
"Id": "aa13d08f2676e40df5a82521fccc4e402ef6b04f82bcd414cd065a1859b3799d",
"Created": "2019-01-31T21:32:02.381082005-05:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
....
...
..
.
]
并配置rancher-config.yml
如下并rke up --config ./rancher-config.yml
再次运行
nodes:
- address: 192.168.88.204
internal_address: 172.17.0.1
...
...
..
..
推荐阅读
- python - PyjasperReport:ModuleNotFoundError:没有名为“pyreportjasper”的模块
- jax-rs - NullPointerException 使用 DropwizardAppExtension 和 JUnit5
- c++ - 排序 std::reference_wrapper 数组时出现问题,引用向量
- assembly - 为什么我应该在这个循环模拟中使用堆栈?
- docker - 如果服务已经在运行,我如何指示 docker-compose 不启动它?
- regression - 如何使用稳健的线性回归或其他用户选择的模型去趋势 xarray.DataSet(或 xarray.DataArray)?
- c# - LINQ 组总和查询中的 Bool to int
- ruby-on-rails - 如何为 devise_intiable 邮件创建预览?
- android - 如何在Android Studio中使图像中的特定颜色透明?
- python - 在 TensorFlow 中显示单个数据集元素