Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.28 国内 kubeadm init 失败的问题 #22

Closed
zhaozhong opened this issue Dec 12, 2023 · 2 comments
Closed

v1.28 国内 kubeadm init 失败的问题 #22

zhaozhong opened this issue Dec 12, 2023 · 2 comments

Comments

@zhaozhong
Copy link

老师好,在国内 init 时会卡住,查看错误日志发现是 containerd 会从 registry.k8s.io/pause:3.6 拉取镜像,而国内网络环境无法访问这个地址。

相信国内的很多同学会碰到这个问题,课程可以收录关于此问题的解决。

解决办法详见:kubernetes/kubeadm#2851 (comment)

@chenkewen2007
Copy link
Contributor

是的。我也发现了此问题。也可以在 echo "[TASK 5] Install containerd runtime"内进行修改,在创建配置文件时候直接替换

在老师的脚本中,加入以下行:
sed -i 's/registry.k8s.io/pause:3.6/registry.aliyuncs.com/google_containers/pause:3.9/g' /etc/containerd/config.toml

echo "[TASK 5] Install containerd runtime"
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt -qq update >/dev/null 2>&1
apt install -qq -y containerd.io >/dev/null 2>&1
containerd config default >/etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
sed -i 's/registry.k8s.io\/pause:3.6/registry.aliyuncs.com\/google_containers\/pause:3.9/g' /etc/containerd/config.toml 
systemctl restart containerd
systemctl enable containerd >/dev/null 2>&1

@xiaopeng163
Copy link
Owner

是的。我也发现了此问题。也可以在 echo "[TASK 5] Install containerd runtime"内进行修改,在创建配置文件时候直接替换

在老师的脚本中,加入以下行: sed -i 's/registry.k8s.io/pause:3.6/registry.aliyuncs.com/google_containers/pause:3.9/g' /etc/containerd/config.toml

echo "[TASK 5] Install containerd runtime"
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt -qq update >/dev/null 2>&1
apt install -qq -y containerd.io >/dev/null 2>&1
containerd config default >/etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
sed -i 's/registry.k8s.io\/pause:3.6/registry.aliyuncs.com\/google_containers\/pause:3.9/g' /etc/containerd/config.toml 
systemctl restart containerd
systemctl enable containerd >/dev/null 2>&1

您好,非常感谢,可以帮提个PR么,谢谢🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants