換橋接模式,換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