Add K3s containerd proxy config
This commit is contained in:
@@ -60,6 +60,28 @@ git config --global http.proxy http://用户名:密码@东京服务器IP:3128
|
|||||||
git config --global https.proxy http://用户名:密码@东京服务器IP:3128
|
git config --global https.proxy http://用户名:密码@东京服务器IP:3128
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### K3s (containerd) 配置
|
||||||
|
K3s 默认使用 containerd,不走 systemd代理,需要在 k3s service 环境变量中配置。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 添加代理环境变量到 k3s service
|
||||||
|
mkdir -p /etc/systemd/system/k3s.service.d
|
||||||
|
cat > /etc/systemd/system/k3s.service.d/http-proxy.conf <<EOF
|
||||||
|
[Service]
|
||||||
|
Environment="HTTP_PROXY=http://用户名:密码@东京服务器IP:3128"
|
||||||
|
Environment="HTTPS_PROXY=http://用户名:密码@东京服务器IP:3128"
|
||||||
|
Environment="NO_PROXY=localhost,127.0.0.1,10.0.0.0/8,.svc,.cluster.local"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl daemon-reload && systemctl restart k3s
|
||||||
|
```
|
||||||
|
|
||||||
|
验证:
|
||||||
|
```bash
|
||||||
|
crictl pull nginx
|
||||||
|
kubectl run nginx --image=nginx
|
||||||
|
```
|
||||||
|
|
||||||
### 取消代理(如需直连)
|
### 取消代理(如需直连)
|
||||||
```bash
|
```bash
|
||||||
git config --global --unset http.proxy
|
git config --global --unset http.proxy
|
||||||
|
|||||||
Reference in New Issue
Block a user