如何使用Kubeadm在代理服务器后面安装Kubernetes集群?

时间:2017-08-09 02:37:08

标签: proxy kubernetes kubeadm

在使用Kubeadm安装Kubernetes时遇到了一些问题。我在企业网络背后工作。我在会话环境中声明了代理设置。

$ export http_proxy=http://proxy-ip:port/
$ export https_proxy=http://proxy-ip:port/
$ export no_proxy=master-ip,node-ip,127.0.0.1

安装完所有必要的组件和依赖项之后,我开始初始化集群。为了使用当前的环境变量,我使用了sudo -E bash

$ sudo -E bash -c "kubeadm init --apiserver-advertise-address=192.168.1.102 --pod-network-cidr=10.244.0.0/16"

然后输出消息永远挂在下面的消息中。

[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[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 API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [loadbalancer kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.1.102]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing 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: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready

然后我发现当kubelet不断请求kube-apiserver时,没有任何kube组件出现。 sudo docker ps -a没有返回任何内容。

可能的根本原因是什么?

提前致谢。

1 个答案:

答案 0 :(得分:1)

我强烈怀疑它正试图下载gcr.io/google_containers/hyperkube:v1.7.3或其他什么的docker镜像,这需要教导docker守护程序关于代理,in this way using systemd

这肯定会解释为什么docker ps -a什么都没有显示,但我希望dockerd记录journalctl -u docker.service(或系统中的等价物)来抱怨它无法从gcr.io < / p>

根据我从kubeadm参考指南中读到的内容,他们期望你在目标机器上修补systemd配置以暴露这些环境变量,而不仅仅是在启动kubeadm的shell中设置它们(尽管肯定可能是功能请求)