如何在kubernetes中配置代理来拉取镜像?

问题描述 投票:0回答:1

我安装了 kubernetes,其中仅包含 helm、kube apps、contanerd.io。 Docker 未安装。我的互联网连接仅抛出代理。 我正在尝试在舵的帮助下汇集长角容器。但它不起作用。已读取

.bashrc
中的
/root/.bashrc
中的导出代理,但未使用。我只从 root 开始工作。 bashrc 中的代理配置

http_proxy=http://proxy.example.com
https_proxy=http://proxy.example.com
HTTP_PROXY=http://proxy.example.com
HTTPS_PROXY=http://proxy.example.com

我一直都必须编写代理才能使命令正常工作。喜欢

 https_proxy=http://proxy.example.com helm install longhorn/longhorn --name longhorn --namespace longhorn-system

但是当所有东西都安装到 kuber 中时,这不起作用。每个 longhorn 容器都有一个错误

Failed to pull and image

我的代理配置有什么问题?如何在 kubernetes 上正确配置代理以池化互联网上的图像?

kubernetes proxy configuration
1个回答
2
投票

据我从您的配置中了解到,您没有配置containerd运行时代理设置。因为K8s使用containerd运行时拉取镜像。如果您的电脑位于代理后面,并且不直接使用代理系统设置(例如 docker、containerd 等),则应始终配置应用程序设置

在终端上运行:

sudo mkdir -p /etc/systemd/system/containerd.service.d
sudo touch /etc/systemd/system/containerd.service.d/http-proxy.conf
nano /etc/systemd/system/containerd.service.d/http-proxy.conf

复制并粘贴到 http-proxy.conf 中:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com"
Environment="HTTPS_PROXY=http://proxy.example.com"
Environment="NO_PROXY=localhost"

然后重启containerd服务:

sudo systemctl daemon-reload
sudo systemctl restart containerd
sudo systemctl show --property=Environment containerd
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.