5.1.1、主机配置
5.1.1.1、配置要求
硬件需求根据Rancher部署的规模进行扩展。根据需求配置每个节点。
部署大小 | 集群(个) | 节点(个) | vCPU | 内存 |
---|---|---|---|---|
小 | 不超过5 | 最多50 | 4C | 16GB |
中 | 不超过100 | 最多500 | 8C | 32GB |
5.1.1.2、操作系统选择
- Ubuntu 16.04(64位)
- Centos/RedHat Linux 7.5+(64位)
- RancherOS 1.3.0+(64位)
- Windows Server 1803(64位)
5.1.1.3、Docker版本选择
支持的Docker版本
- 1.12.6
- 1.13.1
- 17.03.2
- 17.06 (for Windows)
5.1.1.4、主机名配置
因为K8S的规定,主机名只支持包含 - 和 .(中横线和点)两种特殊符号,并且主机名不能出现重复。
5.1.1.5、Hosts
配置每台主机的hosts(/etc/hosts),添加host_ip $hostname到/etc/hosts文件中。
5.1.1.6、CentOS关闭selinux
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
5.1.1.7、关闭防火墙(可选)或者放行相应端口
对于刚刚接触Rancher的用户,建议在关闭防火墙的测试环境或桌面虚拟机来运行rancher,以避免出现网络通信问题。
- 关闭防火墙
1、CentOSsystemctl stop firewalld.service && systemctl disable firewalld.service
2、Ubuntuufw disable
- 端口放行
端口放行请查看端口需求
5.1.1.8、配置主机时间、时区、系统语言
- 查看时区
date -R 或者 timedatectl
- 修改时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- 修改系统语言环境
sudo echo 'LANG="en_US.UTF-8"' >> /etc/profile;source /etc/profile
- 配置主机NTP时间同步
5.1.1.9、Kernel性能调优
【注意】: 数值根据实际环境自行配置
cat >> /etc/sysctl.conf<<EOF net.ipv4.ip_forward=1 net.bridge.bridge-nf-call-iptables=1 net.ipv4.neigh.default.gc_thresh1=4096 net.ipv4.neigh.default.gc_thresh2=6144 net.ipv4.neigh.default.gc_thresh3=8192 EOF
最后执行保存配置
sysctl -p
5.1.1.10、内核模块
加载以下模块
modprobe br_netfilter modprobe ip6_udp_tunnel modprobe ip_set modprobe ip_set_hash_ip modprobe ip_set_hash_net modprobe iptable_filter modprobe iptable_nat modprobe iptable_mangle modprobe iptable_raw modprobe nf_conntrack_netlink modprobe nf_conntrack modprobe nf_conntrack_ipv4 modprobe nf_defrag_ipv4 modprobe nf_nat modprobe nf_nat_ipv4 modprobe nf_nat_masquerade_ipv4 modprobe nfnetlink modprobe udp_tunnel modprobe VETH modprobe VXLAN modprobe x_tables modprobe xt_addrtype modprobe xt_conntrack modprobe xt_comment modprobe xt_mark modprobe xt_multiport modprobe xt_nat modprobe xt_recent modprobe xt_set modprobe xt_statistic modprobe xt_tcpudp
5.1.1.11、ETCD集群容错表
建议在ETCD集群中使用奇数个成员,通过添加额外成员可以获得更高的失败容错。
集群大小 | MAJORITY | 失败容错 |
---|---|---|
1 | 1 | 0 |
2 | 2 | 0 |
3 | 2 | 1 |
4 | 3 | 1 |
5 | 3 | 2 |
6 | 4 | 2 |
7 | 4 | 3 |
8 | 5 | 3 |
9 | 5 | 4 |