1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| # disable swap swapoff -a # 编辑 /etc/fstab 去掉 swap 的配置
# 配置启动加载模块 modprope br_netfilter # 在 /etc/modules 追加 br_netfilter,以便重启后自动加载 br_netfilter
# 配置 cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-arptables = 1 EOF sysctl --system
# install k8s,k8s的版本需要与crio的版本对应,crio是1.27的,k8s的也是1.27 apt-get install -y apt-transport-https curl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
KUBE_VERSION=1.27.1-00 apt-get update apt-get install -y kubelet=$KUBE_VERSION kubeadm=$KUBE_VERSION kubectl=$KUBE_VERSION # 锁定版本 apt-mark hold kubelet kubeadm kubectl
|