rke部署企业生产级k8s,增加集群节点
- rke支持为worker和controplane主机添加或者删除节点,可以通过修改cluster.yml文件的内容,添加额外的节点,并指定他们所在的kubernetes集群中的校色;或从cluster.yml在所在的主机删除节点信息,已达到删除节点的目的。
- 通过运行rke up --update-only,可以运行rke up --update-only命令,只添加或者删除工作节点这将会忽略cluster.yml中的工作节点以外的其他内容。
1.配置主机名称
2.配置静态IP
- 若是服务器使用外网ip即可,若是使用虚拟机则需要配置静态ip地址
3.主机与地址解析
cat /etc/hosts
vim /etc/hosts
4.配置ip_forward及过滤机制
vim /etc/sysctl.conf
cat /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
modprobe br_netfilter
sysctl -p
5.关闭防火墙,sestatus和swap分区
firewall-cmd --state
sestatus
- 检查swap分区关闭,如果swap分区里边写的全是0就已经关闭了
free -m
cat /etc/fstab
6.时间同步
yum -y install ntpdate
crontab -e
crontab -l
7.在该主机部署docke
rpm -qa | grep docker-ce
[root@woker02 ~]
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2022-09-24 17:46:19 CST; 2 days ago
Docs: https://docs.docker.com
Main PID: 2901 (dockerd)
Tasks: 10
Memory: 33.6M
CGroup: /system.slice/docker.service
└─2901 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Sep 24 17:46:18 woker02 dockerd[2901]: time="2022-09-24T17:46:18.936640604+08:00" level=info ms...grpc
Sep 24 17:46:18 woker02 dockerd[2901]: time="2022-09-24T17:46:18.936653358+08:00" level=info ms...grpc
Sep 24 17:46:18 woker02 dockerd[2901]: time="2022-09-24T17:46:18.946290501+08:00" level=info ms...ay2"
Sep 24 17:46:18 woker02 dockerd[2901]: time="2022-09-24T17:46:18.949952347+08:00" level=info ms...rt."
Sep 24 17:46:19 woker02 dockerd[2901]: time="2022-09-24T17:46:19.038810394+08:00" level=info ms...ess"
Sep 24 17:46:19 woker02 dockerd[2901]: time="2022-09-24T17:46:19.075148788+08:00" level=info ms...ne."
Sep 24 17:46:19 woker02 dockerd[2901]: time="2022-09-24T17:46:19.092537978+08:00" level=info ms...0.18
Sep 24 17:46:19 woker02 dockerd[2901]: time="2022-09-24T17:46:19.092598632+08:00" level=info ms...ion"
Sep 24 17:46:19 woker02 systemd[1]: Started Docker Application Container Engine.
Sep 24 17:46:19 woker02 dockerd[2901]: time="2022-09-24T17:46:19.112641527+08:00" level=info ms...ock"
Hint: Some lines were ellipsized, use -l to show in full.