三、简配版集群,适用于demo环境
1.集群架构设计
主机名 | 角色 | 配置(核数,内存,磁盘) |
---|---|---|
Master | RKE,controlplane,etcd,worker,rancher-master | 2C 8G 40G |
Slaver1 | controlplane,worker,rancher-master | 2C 8G 40G |
Slaver2 | controlplane,worker,rancher-master | 2C 8G 40G |
2.预期目标
使用RKE拉起k8s环境,在k8s环境中使用helm拉起rancher集群(2台master角色+1台worker角色),并通过自签证书访问rancherUI页面(hosts配置域名映射,http协议访问)
3.集群环境搭建
操作系统 | CentOS Linux release 7.6.1810 |
---|---|
Docker | 19.03.6.10.0 |
Helm | v3.2.4 |
rke | v1.3.6 |
K8s | v1.21.8 |
rancher | 待定,后期完善进来 |
这里以master节点为例
vim/etc/hostname
vim/etc/hosts
yum update-y
yum install net-tools vim wget lrzsz git-y
yum install-y yum-utils device-mapper-persistent-data lvm2
yum-config-manager--add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install-y docker-ce-19.03.6 docker-ce-cli-19.03.6 containerd.io
chkconfig docker on
service docker start
systemctl start docker
systemctl enable docker
阿里云镜像加速器地址:
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
systemctl stop firewalld
systemctl disable firewalld
iptables-F
sed-i"s/^SELINUX=enforcing/SELINUX=disabled/g"/etc/selinux/config
sed-i"s/^SELINUX=permissive/SELINUX=disabled/g"/etc/selinux/config
setenforce 0
cat/etc/selinux/config
vim/etc/fstab
注释掉swap那行
或者
swapoff-a
sed-i'/swap/s/^\(.*\)$/#\1/g'/etc/fstab
您的SSH server全系统配置文件,位于/etc/ssh/sshd_config,该文件必须包含以下代码,允许TCP转发。
AllowTcpForwarding yes
cat>>/etc/sysctl.conf<<EOF
net.ipv4.ip_forward=1
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.neigh.default.gc_thresh1=4096
net.ipv4.neigh.default.gc_thresh2=6144
net.ipv4.neigh.default.gc_thresh3=8192
vm.swappiness=0
fs.file-max=52706963
fs.nr_open=52706963
EOF
modprobe br_netfilter
sysctl -p
yum install-y ntpdate
ntpdate-u ntp.api.bz
echo"*/5****ntpdate time7.aliyun.com>/dev/null 2>&1">>/etc/crontab
service crond restart
chkconfig crond on
useradd rke
usermod-a-G docker rke
passwd rke
下载地址:https://github.com/rancher/rke/releases/download/v1.3.6/rke_linux-amd64
chmod+x rke_linux-amd64
cp rke_linux-amd64/usr/local/bin/rke
rke--version
chown rke.rke/usr/local/bin/rke
chmod 755/usr/local/bin/rke
./rke–version
./rke config--list-version--all
因为安装操作流程过长,所以分开几篇文章写,未完待续,嘻嘻,后续内容剧透:
RKE集群的具体安装步骤以及优化事项,欢迎对RKE安装高可用k8s集群,部署高可用rancher集群感兴趣的同学持续关注作者哟