https://blog.csdn.net/langmeng110/article/details/119522721
使用sealos快速离线部署k8s
https://wenku.baidu.com/view/07a0525859cfa1c7aa00b52acfc789eb162d9e44.html
https://zhuanlan.zhihu.com/p/502275849
https://icloudnative.io/posts/sealos/
sealos
关闭selinux
setenforce 0
sed -i 's/^ *SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
cat /etc/selinux/config
关闭 swap
swapoff -a && sudo sed -i 's/^.*swap/#&/g' /etc/fstab
#设置主机名
hostnamectl set-hostname node5
vi /etc/hosts #设置node5
sudo sed -i "s/lren/$/g" /etc/hosts
sed -i "s/ localhost/ $/g" /etc/hosts
#测试代码
echo "127.0.1.1 lren" | sed "s/lren/$/g"
#时间同步
crontab -e
#安装apt install cron
0 */1 * * * ntpdate time1.aliyun.com
#无需yum install kubectl=1.24.0-00
wget https://github.com/labring/sealos/releases/download/v4.1.3/sealos_4.1.3_linux_amd64.tar.gz \
&& tar zxvf sealos_4.1.3_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
wget https://github.com/labring/sealos/releases/download/v4.0.0/sealos_4.0.0_linux_amd64.tar.gz \
&& tar zxvf sealos_4.0.0_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
# 创建单机集群
sealos run labring/kubernetes:v1.24.0 labring/calico:v3.22.1
#创建一个高可用集群
sealos run labring/kubernetes:v1.24.0 labring/calico:v3.22.1 \
--masters 192.168.110.34,192.168.64.22,192.168.64.20 \
--nodes 192.168.64.21,192.168.64.19 -p [your-ssh-passwd]
#添加主节点或者从节点
sealos add --masters 192.168.64.20 --nodes 192.168.64.21,192.168.64.22
#删除集群
sealos reset
#查看镜像的启动情况
crictl ps -a
crictl pods
crictl images
seaos使用配置文件启动集群
#生成Clusterfile
sealos gen labring/kubernetes:v1.24.0 labring/calico:v3.22.1 --masters 192.168.110.47 --nodes 192.168.110.48,192.168.110.49 --passwd lren.org > Clusterfile
#启动集群
sealos apply -f Clusterfile
sealctl 管理命令
#同级别命令
tar zxvf sealos_4.0.0_linux_amd64.tar.gz sealctl && chmod +x sealctl && mv sealctl /usr/bin
chmod +x sealctl &&mv sealctl /usr/bin/
sealctl get nodes #等于sealctl kube get nodes
sealos exec "cat /etc/hosts"
安装kubectl
yum update
#设置yum源
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
yum install kubectl=1.24.0-00
yum install kubectl
kubectl get nodes
kubeadm alpha certs check-expiration
sealer
https://github.com/sealerio/sealer