gpt4 book ai didi

docker - 如何为Docker配置Polipo的HTTP代理以部署Kubernetes

转载 作者:行者123 更新时间:2023-12-02 20:10:09 25 4
gpt4 key购买 nike

我是Docker的初学者。想知道这样做是否是一种好习惯,什么是最好的方法呢?

系统:Ubuntu LTS 16.04.2

我想在具有代理的服务器上部署Kubernetes。由于某些问题,我使用polipo将sock5代理转换为http代理。 http代理已成功应用于终端。然后我搜索了:
https://docs.docker.com/engine/admin/systemd/#http-proxy
并且我在 /etc/systemd/system/docker.service.d/http-proxy.conf 中添加了HTTP_PROXY环境变量:

[Service]

Environment="HTTP_PROXY=http://127.0.0.1:8123/"



然后执行以下操作:

$ sudo systemctl show --property Environment docker Environment=HTTP_PROXY=http://127.0.0.1:8123/

$ sudo systemctl daemon-reload

$ sudo systemctl restart docker



然后我成功安装了 kubelet kubeadm kubectl kubernetes-cni 并运行了以下命令:

# kubeadm init



这是操作的结果:

root@ubuntu16:~# kubeadm init

[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.

[init] Using Kubernetes version: v1.8.2

[init] Using Authorization modes: [Node RBAC]

[preflight] Running pre-flight checks

[preflight] WARNING: Connection to "https://59.64.78.138:6443" uses proxy

"http://127.0.0.1:8123/". If that is not intended, adjust your proxy settings

[preflight] Starting the kubelet service

[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)

[certificates] Generated ca certificate and key.

[certificates] Generated apiserver certificate and key.

[certificates] apiserver serving cert is signed for DNS names [ubuntu16 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 my_server_IP]

[certificates] Generated apiserver-kubelet-client certificate and key.

[certificates] Generated sa key and public key.

[certificates] Generated front-proxy-ca certificate and key.

[certificates] Generated front-proxy-client certificate and key.

[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"

[kubeconfig] Wrote KubeConfig file to disk: "admin.conf"

[kubeconfig] Wrote KubeConfig file to disk: "kubelet.conf"

[kubeconfig] Wrote KubeConfig file to disk: "controller-manager.conf"

[kubeconfig] Wrote KubeConfig file to disk: "scheduler.conf"

[controlplane] Wrote Static Pod manifest for component kube-apiserver to "/etc/kubernetes/manifests/kube-apiserver.yaml"

[controlplane] Wrote Static Pod manifest for component kube-controller-manager to "/etc/kubernetes/manifests/kube-controller-manager.yaml"

[controlplane] Wrote Static Pod manifest for component kube-scheduler to "/etc/kubernetes/manifests/kube-scheduler.yaml"

[etcd] Wrote Static Pod manifest for a local etcd instance to "/etc/kubernetes/manifests/etcd.yaml"

[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests"

[init] This often takes around a minute; or longer if the control plane images have to be pulled.



然后它不继续,我跑了

# systemctl status kubelet

● kubelet.service - kubelet: The Kubernetes Node Agent

Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)

Drop-In: /etc/systemd/system/kubelet.service.d

      └─10-kubeadm.conf, 90-local-extras.conf

Active: active (running) since Sun 2017-11-05 21:17:37 CST; 9min ago

Docs: http://kubernetes.io/docs/

Main PID: 19363 (kubelet)

Tasks: 14

Memory: 39.9M

 CPU: 14.229s

CGroup: /system.slice/kubelet.service

      └─19363 /usr/bin/kubelet --bootstrap->?

kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/k

Nov 05 21:26:28 ubuntu16 kubelet[19363]: W1105 21:26:28.959628 19363 cni.go:196] Unable to update cni config: No ne

Nov 05 21:26:28 ubuntu16 kubelet[19363]: E1105 21:26:28.960538 19363 kubelet.go:2095] Container runtime network not

Nov 05 21:26:33 ubuntu16 kubelet[19363]: W1105 21:26:33.962500 19363 cni.go:196] Unable to update cni config: No ne

Nov 05 21:26:33 ubuntu16 kubelet[19363]: E1105 21:26:33.963407 19363 kubelet.go:2095] Container runtime network not

Nov 05 21:26:38 ubuntu16 kubelet[19363]: W1105 21:26:38.974986 19363 cni.go:196] Unable to update cni config: No ne

Nov 05 21:26:38 ubuntu16 kubelet[19363]: E1105 21:26:38.975851 19363 kubelet.go:2095] Container runtime network not

Nov 05 21:26:43 ubuntu16 kubelet[19363]: W1105 21:26:43.977879 19363 cni.go:196] Unable to update cni config: No ne

Nov 05 21:26:43 ubuntu16 kubelet[19363]: E1105 21:26:43.978806 19363 kubelet.go:2095] Container runtime network not

Nov 05 21:26:48 ubuntu16 kubelet[19363]: W1105 21:26:48.992642 19363 cni.go:196] Unable to update cni config: No ne

Nov 05 21:26:48 ubuntu16 kubelet[19363]: E1105 21:26:48.993587 19363 kubelet.go:2095] Container runtime network not

lines 1-23/23 (END)



现在我很困惑如何解决这个问题。我正在网上搜索很长时间。但是没用。请帮助或尝试给出一些想法来实现这一目标。

提前致谢。

最佳答案

安装它,我进行了修改以在docker&kubelet之间对齐cfgroups:

docker 信息| grep -i cgroup

在文件 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf中
修改相应的行以具有:

Environment =“KUBELET_CGROUP_ARGS =-cgroup-driver = cgroupfs”

再见

关于docker - 如何为Docker配置Polipo的HTTP代理以部署Kubernetes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47122761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com