御风而翔  
个人云笔记

视频: https://www.bilibili.com/video/BV1Qt4y1H7fV/?spm_id_from=333.337.search-card.all.click&vd_source=ccc2f6b39d1d0ceddfbdd35285fe4788

文档:https://kubernetes.io/zh-cn/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/

1. 主机系统配置

  • 更换主机名

          因为我是复制的虚机,所以换下名字。

    hostnamectl  set-hostname   name

  • 关闭swap

确认关没关   free   -g

关闭 swapoff  -a

配置文件,重启之后关  /etc/fstab 注释掉swap那行

  • 系统参数配置,转发 IPv4 并让 iptables 看到桥接流量 

执行下述指令:

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# 设置所需的 sysctl 参数,参数在重新启动后保持不变
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables  = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward                 = 1
EOF

# 应用 sysctl 参数而不重新启动
sudo sysctl --system
通过运行以下指令确认 br_netfilter 和 overlay 模块被加载:

lsmod | grep br_netfilter
lsmod | grep overlay
通过运行以下指令确认 net.bridge.bridge-nf-call-iptables、net.bridge.bridge-nf-call-ip6tables 和 net.ipv4.ip_forward 系统变量在你的 sysctl 配置中被设置为 1:

sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward

 

 

2.安装运行时

https://github.com/containerd/containerd/blob/main/docs/getting-started.md

2.1: Installing containerd

 1. 下载

https://github.com/containerd/containerd/releases/download/v1.6.20/containerd-1.6.20-linux-amd64.tar.gz

2. 解压

tar Cxzvf /usr/local containerd-1.6.20-linux-amd64.tar.gz

3. 配置

wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service

mkdir -p /usr/local/lib/systemd/system/
cp containerd.service /usr/local/lib/systemd/system/containerd.service

systemctl daemon-reload
systemctl enable --now containerd

 

2.2 : Installing runc

wget https://github.com/opencontainers/runc/releases/download/v1.1.7/runc.amd64
install -m 755 runc.amd64 /usr/local/sbin/runc

 

2.3 . 配置 systemd cgroup 驱动 

mkdir /etc/containerd/
containerd config default > /etc/containerd/config.toml

修改config.toml文件:SystemdCgroup = true

systemctl restart containerd

systemctl restart containerd

 

 
posted on 2023-05-05 23:42  个人记录  阅读(294)  评论(0编辑  收藏  举报