1.环境配置
主机名 | IP地址 | CPU | 内存 | 操作系统 | 硬盘 |
k8s-master | 192.168.119.85 | 4c | 8g | centos7.9 | 40g |
k8s-node1 | 192.168.119.140 | 4c | 8g | centos7.9 | 40g |
k8s-node2 | 192.168.119.72 | 4c | 8g | centos7.9 | 40g |
2.初始化配置
(1)关闭防火墙
systemctl stop firewalld.service
systemctl status firewalld.service
systemctl disable firewalld.service
(2)关闭swap
修改/etc/fstab文件,将最后一行带有swap注释
vi /etc/fstab
(3)关闭selinux
将/etc/sysconfig/selinux ,将SELINUX=enforcing改为SELINUX=disabled
vi /etc/sysconfig/selinux
重启虚拟机生效
reboot
3.配置hosts
cat >> /etc/hosts << EOF
192.168.119.85 k8s-master
192.168.119.140 k8s-node1
192.168.119.72 k8s-node2
EOF
4. 安装docker
yum 方式安装
下面的yum-config-manager是yum-utils中