1.环境说明
虚拟机工具:VirtualBox 7.0
虚拟机操作系统:Centos 7(CentOS-7-x86_64-Minimal-2003.iso)
虚拟机配置:2核CPU、2G内存、40G硬盘
虚拟机网络模式:仅主机(Host-Only)网络,此网络模式下物理机能ping通虚拟机,虚拟机之间能相互ping通,虚拟机无法联网
K8s版本:v1.20
Docker版本:19.03.9
SSH工具:FinalShell
单Master节点虚拟机角色及IP规划:
Master1:192.168.56.201
Node1:192.168.56.202
Node2:192.168.56.203
软件部署规划:
Master1:kube-apiserver,kube-controller-manager,kube-scheduler,kubelet,kube-proxy,etcd,registry,ntp
Node1:kubelet,kube-proxy,docker,etcd,ntp
Node2:kubelet,kube-proxy,docker,etcd,ntp
部署所用到的文件百度网盘下载:
链接:https://pan.baidu.com/s/1LXB_APf_EHSMqKjjOLpx2w?pwd=navy
提取码:navy
2.准备工作
2.1 设置Master1、Node1、Node2虚拟机为静态ip(Master&Node)
2.2 将网盘下载的文件放到3台虚拟机的/opt/release目录下(Master&Node)
2.3 升级linux内核为5.4.228并重启(Master&Node)
cd /opt/release/rpm/kernel rpm -ivh *.rpm --force --nodeps
grub2-set-default 'CentOS Linux (5.4.228-1.el7.elrepo.x86_64) 7 (Core)'
reboot
2.4 重启后验证是否升级成功(Master&Node)
2.5 系统初始化设置,注意主机名需要改(Master&Node)
# 1、关闭防火墙 systemctl stop firewalld systemctl disable firewalld # 2、关闭selinux sed -i 's/enforcing/disabled/' /etc/selinux/config setenforce 0 # 3、关闭swap swapoff -a sed -ri 's/.*swap.*/#&/' /etc/fstab # 4、根据规划设置主机名 hostnamectl set-hostname k8s-master1 # 5、在master添加hosts cat >> /etc/hosts << EOF 192.168.56.201 k8s-master1 192.168.56.202 k8s-node1 192.168.56.203 k8s-node2 EOF
# 6、将桥接的IPv4流量传递到iptables的链 cat > /etc/sysctl.d/k8s.conf << EOF net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF sysctl --system
标签:Node,Master1,kube,虚拟机,离线,etc,集群,Master,K8s From: https://www.cnblogs.com/whjblog/p/17148913.html