不解释了,图下可以看出cri-o有多轻了
请添加图片描述

开始部署
#!/bin/bash
systemctl disable firewalld
systemctl stop firewalld

cat > /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
net.ipv4.tcp_tw_recycle=0
vm.swappiness=0 # 禁止使用 swap 空间,只有当系统 OOM 时才允许使用它 vm.overcommit_memory=1 # 不检查物理内存是否够用
vm.panic_on_oom=0 # 开启 OOM
fs.inotify.max_user_instances=8192
fs.inotify.max_user_watches=1048576
fs.file-max=52706963
fs.nr_open=52706963
net.ipv6.conf.all.disable_ipv6=1
net.netfilter.nf_conntrack_max=2310720
EOF

swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab
cat <<EOF |  tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF

modprobe br_netfilter
lsmod | grep br_netfilter
sysctl --system
#首先禁用默认软件源
zypper mr -da
zypper ar -fc https://mirrors.aliyun.com/opensuse/distribution/leap/15.3/repo/oss openSUSE-Aliyun-OSS
zypper ar -fc https://mirrors.aliyun.com/opensuse/distribution/leap/15.3/repo/non-oss openSUSE-Aliyun-NON-OSS
zypper ar -fc https://mirrors.aliyun.com/opensuse/update/leap/15.3/oss openSUSE-Aliyun-UPDATE-OSS
zypper ar -fc https://mirrors.aliyun.com/opensuse/update/leap/15.3/non-oss openSUSE-Aliyun-UPDATE-NON-OSS
#刷新
zypper ref

#安装cri-o的时候依赖所有的k8s的组件,所以就不需要再安装kubernetes的任何软件包了
zypper in cri-o
systemctl enable kubelet.service
#替换国内加速器
sed -i "s#registry.opensuse.org#0k0953tv.mirror.aliyuncs.com#g" /etc/containers/registries.conf
cat > /etc/crictl.yaml <<EOF
runtime-endpoint: unix:///var/run/crio/crio.sock
image-endpoint: unix:///var/run/crio/crio.sock
timeout: 10
debug: false
EOF
systemctl start crio.service
systemctl enable crio.service
echo "测试拉取镜像"
crictl pull nginx
crictl images
#输出镜像就部署好了

接下来初始化集群即可

kubeadm init --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16

安装kubectl工具

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

最后不再解释了

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐