10分钟搭建k8s

换桥接模式,换sealos
桥接模式
部署出问题了,用这个:
ipconfig
以太网适配器 以太网:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::29f9:1da9:30:3d48%8
IPv4 地址 . . . . . . . . . . . . : 10.1.161.207
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 10.1.161.1
查看网卡类型 
Realtek PCIe GbE Family Controller
设置VMnet0的信息
设置虚拟机信息
虚拟机的网络适配器模式设置为桥接模式,并选中“复制网络物理连接状态”
虚拟机里面更改
vi /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR:10.1.161.208
GATEWAY:10.1.161.1
sudo service network restart
差不多了,然后换一下开机界面
systemctl get-default
命令行
systemctl set-default multi-user.target
图形
systemctl set-default graphical.target
克隆四台节点
一台作为master节点负责调度
其它三台负责数据库集群
配置防火墙等、关闭swap分区、时间服务
systemctl stop firewalld && systemctl disable firewalld
systemctl stop NetworkManager && systemctl disable NetworkManager
setenforce 0
sed -i s/SELINUX=enforcing/SELINUX=disabled/ /etc/selinux/config
swapoff -a
sed -ri 's/.*swap.*/#&/' /etc/fstab
yum install chrony -y
systemctl enable chronyd --now
chronyc sources
升级系统内核到最新 Linux master 5.4.270-1.el7.elrepo.x86_64
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install -y kernel-lt
grep initrd16 /boot/grub2/grub.cfg
grub2-set-default 0
reboot
uname -a
-------------------------------
------------------------------------------
cat <<EOF >> /etc/hosts
10.1.161.209 sealos-master01
10.1.161.210 sealos-node01
10.1.161.211 sealos-node02
10.1.161.212 sealos-node03
EOF
mkdir /data
将sealos二进制文件上传sealos-master01:/data
将kubernates离线安装包上传sealos-master01:/data
sealos_5.0.0-beta4_linux_amd64.tar.gz
kubernetes-1.27.10.tar.gz
cd /data
授权并移动到/usr/bin目录中
chmod +x sealos && mv sealos /usr/bin
集群镜像都可以在 
https://github.com/labring-actions/cluster-image-docs
仓库里找到
设置主机名
#!/bin/bash
# Set hostname for sealos-master01
sudo hostnamectl set-hostname sealos-master01
# Set hostname for sealos-node01
sudo hostnamectl set-hostname sealos-node01
# Set hostname for sealos-node02
sudo hostnamectl set-hostname sealos-node02
# Set hostname for sealos-node03
sudo hostnamectl set-hostname sealos-node03
单master多node: 
sealos run registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.27.10 registry.cn-shanghai.aliyuncs.com/labring/helm:v3.9.4 registry.cn-shanghai.aliyuncs.com/labring/cilium:v1.14.7 \
--masters 10.1.161.209 \
--nodes 10.1.161.210,10.1.161.211,10.1.161.212 -p root
sealos run registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.27.10 registry.cn-shanghai.aliyuncs.com/labring/helm:v3.9.4 registry.cn-shanghai.aliyuncs.com/labring/cilium:v1.14.7 \
--masters 10.1.161.206 \
--nodes 10.1.161.188,10.1.161.189 -p root
增加master节点:
sealos add --masters 192.168.198.127 --master 192.168.198.128
或者多个连续IP
sealos add --masters 192.168.198.127-192.168.198.128
删除指定master节点 
sealos delete --masters 192.168.198.122 --master 192.168.198.123
或者多个连续IP
sealos delete --masters 192.168.198.122-192.168.198.123
新增node
sealos add --nodes 192.168.198.127 --node 192.168.198.128
或者多个连续IP
sealos add --nodes 192.168.198.127-192.168.198.128
删除node
sealos delete --nodes 192.168.198.125 --node 192.168.198.126
或者多个连续IP
sealos delete --nodes 192.168.198.125-192.168.198.126
清理集群
sealos delete --all -f 
更多请看sealos官网:
https://sealos.run/docs/self-hosting/lifecycle-management/quick-start/deploy-kubernetes

热门相关:重生世家子   绝宠小医妃:王爷,来一针   大文豪   嫡女谋:逆天三小姐   天龙剑尊