kubernetes - 具有两个网络接口的 Kubernetes 互联网访问
问题描述
我是 Kubernetes 的新手,我有一个关于 Kubernetes 网络的问题。在我的设置中,每个节点都有两个接口。第一个接口 (eth0) 在私有范围内(例如 172.20.12.10),第二个有公共地址。
auto eth0
iface eth0 inet static
address 172.20.12.10
netmask 255.255.0.0
network 172.20.0.0
broadcast 172.16.255.255
dns-nameservers 8.8.8.8
auto eth1
iface eth1 inet static
address x.x.x.x
gateway y.y.y.y
显然 kubernetes 网络配置取决于节点默认网关,因此上述节点网络配置无法正常工作。
我的问题是:如何在我的容器中访问互联网?
解决方案
--apiserver-advertise-address
参数 for可kubeadm init
用于使 k8s 使用不同于节点默认网络接口的接口:
--apiserver-advertise-address string
The IP address the API Server will advertise it's listening on.
Specify '0.0.0.0' to use the address of the default network interface.
另外,添加一个标志来/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
指定工作节点的私有 IP:
--node-ip=<private-node-ip>
最后,当您kubeadm join
在工作节点上运行时,请确保您提供 API 服务器的私有 IP。
更多信息在:
推荐阅读
- training-data - python中的新功能...您能否在下面的行中解释一下测试样本的大小是多少?
- c++ - c++文件读写需要同步吗?在窗口操作系统中?
- python - 如何删除日期时间字符串列表的时间部分?
- datagrid - 无法运行 dotnetprojects WpfToolkit
- c# - 属性的 XAML 设置属性
- c - 在 GNU 中,struct 如何从堆栈复制到未初始化的数据段?
- haskell - 如何在 Haskell 中链接二进制函数?
- ios - 如果 UIMenu 包含自定义视图,则 UIMenu 无法出现在 UIBarButtonItem 上
- mysql - Sqoop:通信链路故障
- storage - 什么占据了视频游戏中大部分的存储空间?