Rancher2.0平台的管理和运维
目录
硬件需求
CPU: 2C
内存: 4GB > 注意: 此配置仅为满足小规模测试环境的最低配置。
软件需求
Rancher在以下操作系统及其后续的非主要发行版上受支持:
Ubuntu 16.04.x (64-bit) Docker 17.03.x, 18.06.x, 18.09.x Ubuntu 18.04.x (64-bit) Docker 18.06.x, 18.09.x Red Hat Enterprise Linux (RHEL)/CentOS 7.5+ (64-bit) RHEL Docker 1.13 Docker 17.03.x, 18.06.x, 18.09.x RancherOS 1.3.x+ (64-bit) Docker 17.03.x, 18.06.x, 18.09.x Windows Server version 1803 (64-bit) Docker 17.06
本文档采用CentOS 7作为操作系统
Ubuntu、Centos操作系统有Desktop和Server版本�,选择请安装server版本,别自己坑自己!
软件: Docker
支持的Docker版本:
1.12.6 1.13.1 17.03.2
基础环境配置
关闭SELinux
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
关闭防火墙(可选)或者放行相应端口
systemctl stop firewalld.service && systemctl disable firewalld.service
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保存配置。
内核模块
警告: 如果要使用ceph存储相关功能,需保证worker节点加载RBD模块
[root@localhost ~]# modprobe br_netfilter ip6_udp_tunnel ip_set ip_set_hash_ip ip_set_hash_net iptable_filter iptable_nat iptable_mangle iptable_raw nf_conntrack_netlink nf_conntrack nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat nf_nat_ipv4 nf_nat_masquerade_ipv4 nfnetlink udp_tunnel VETH VXLAN x_tables xt_addrtype xt_conntrack xt_comment xt_mark xt_multiport xt_nat xt_recent xt_set xt_statistic xt_tcpudp
Docker安装与配置
用户配置
因为CentOS的安全限制,通过RKE安装K8S集群时候无法使用root账户。所以,建议CentOS用户使用非root用户来运行docker,
[root@localhost ~]# sudo adduser maxin [root@localhost ~]# sudo passwd maxin Changing password for user maxin. New password: BAD PASSWORD: The password is a palindrome Retype new password: passwd: all authentication tokens updated successfully. [root@localhost ~]# sudo echo 'maxin ALL=(ALL) ALL' >> /etc/sudoers
[root@localhost ~]# su maxin
卸载旧版本Docker软件
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine \ container*
安装docker
# 定义安装版本 export docker_version=18.06.3 # Step 1: 添加软件源信息 sudo yum-config-manager --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo; [maxin@localhost root]$ yum clean all [maxin@localhost root]$ yum repolist # step 2: 安装必要的一些系统工具 sudo yum remove docker docker-client docker-client-latest \ docker-common docker-latest docker-latest-logrotate \ docker-logrotate docker-engine -y; sudo yum update -y; sudo yum install -y yum-utils device-mapper-persistent-data \ lvm2 bash-completion; # Step 3: 更新并安装 Docker-CE sudo yum makecache all; version=$(yum list docker-ce.x86_64 --showduplicates | sort -r|grep ${docker_version}|awk '{print $2}'); sudo yum -y install --setopt=obsoletes=0 docker-ce-${version} docker-ce-selinux-${version}; # 如果已经安装高版本Docker,可进行降级安装(可选) yum downgrade --setopt=obsoletes=0 -y docker-ce-${version} docker-ce-selinux-${version}; # 把当前用户加入docker组 sudo usermod -aG docker `<new_user>`; # 设置开机启动 sudo systemctl enable docker;
执行到此处
参考文档:
[1] https://www.cnrancher.com/docs/rancher/v2.x/cn/overview/quick-start-guide/
[2]基础环境配置:https://www.cnrancher.com/docs/rancher/v2.x/cn/install-prepare/basic-environment-configuration/