一、安装前准备
1,准备6台虚拟机,所有节点至少2U2G。(安装一台其余克隆即可)
| 节点名称 | IP | hostname |
| harbor | 10.10.10.10 | k8s-harbor |
| master1 |
10.10.10.11 | k8s-master1 |
| master2 | 10.10.10.12 | k8s-master2 |
| master3 | 10.10.10.13 | k8s-master3 |
| node1 | 10.10.10.21 | k8s-node1 |
| node2 | 10.10.10.22 | k8s-node2 |
| node3 | 10.10.10.23 | k8s-node3 |
2,安装前配置
①关闭防火墙:
systemctl disable firewalld.service --now && systemctl status firewalld.service
②关闭Linux安全机制
临时关闭:setenforce 0
setenforce 0
永久关闭:vim /etc/selinux/config
SELINUX=disabled
③关闭swap(k8s禁止虚拟内存以提高性能)
swapoff -a #临时关闭
sed -ri 's/.*swap.*/#&/' /etc/fstab #永久关闭
查看是否关闭:
free -m #如果已关闭 Swap: 0 0 0
swapoff -a && sed -ri 's/.*swap.*/#&/' /etc/fstab && free -m
④设置主机名
10.10.10.10
hostnamectl set-hostname k8s-harbor && /bin/bash
10.10.10.11
hostnamectl set-hostname k8s-master1 && /bin/bash
10.10.10.21
hostnamectl set-hostname k8s-node1 && /bin/bash
⑤设置host
cat >> /etc/hosts << EOF
10.10.10.10 k8s-harbor
10.10.10.11 k8s-master1
10.10.10.12 k8s-master2
10.10.10.13 k8s-master3
10.10.10.21 k8s-node1
10.10.10.22 k8s-node2
10.10.10.23 k8s-node3
EOF
⑥设置时间同步
⑤NTP同步:yum install chrony.x86_64 -y
vim /etc/chrony.conf
server ntp.aliyun.com iburst
allow 10.10.10.0/24
重启:systemctl enable chronyd --now && systemctl status chronyd
执行时间同步:chronyc sources -v
[root@k8s-master1 ~]# chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | |

最低0.47元/天 解锁文章
2573

被折叠的 条评论
为什么被折叠?



