ubuntuの場合
# コンフィグファイル作成準備
conf=/etc/systemd/system/containerd.service.d/http-proxy.conf
[ -d "${conf%/*}" ] || sudo mkdir "${conf%/*}"
# コンフィグ生成
LOCAL_NETWORK="127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
sudo tee "$conf" <<...
[Service]
Environment="HTTP_PROXY=${http_proxy:-}"
Environment="HTTPS_PROXY=${https_proxy:-}"
Environment="NO_PROXY=${no_proxy:-localhost},${LOCAL_NETWORK}"
...
# 反映
sudo systemctl daemon-reload
sudo systemctl restart containerd
プロキシ環境化で kubernetes を構築するときに、docker のプロキシ設定はしたけど containerd を忘れていると、
という悲しみが待っていることがあります。
失敗例(sudo journalctl -xe -u containerd -f 等で確認)
[ERROR ImagePull]: failed to pull image registry.k8s.io/pause:3.9: output: E0301 12:53:05.384864 5278 remote_image.go:171] "PullImage from image service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/containerd/containerd.sock: connect: no such file or directory\"" image="registry.k8s.io/pause:3.9" time="2023-03-01T12:53:05+09:00" level=fatal msg="pulling image: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/containerd/containerd.sock: connect: no such file or directory\"" , error: exit status 1