部署k8s集群

时间:2018-08-28 10:10:14

标签: kubernetes

我之前已经成功使用“ kubeadm init”部署了一个k8s集群。遇到问题时,我会重新安装k8s。现在,我重新部署了k8s集群失败!

linux操作系统

uname -a
Linux kube-master 4.15.0-33-generic #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

k8s env

kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:14:39Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

我的部署命令:

sudo kubeadm -v 10 init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.0.100 --kubernetes-version v1.11.2

[init] this might take a minute or longer if the control plane images have to be pulled
I0828 17:12:47.780302   28675 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubeadm/v1.11.2 (linux/amd64) kubernetes/bb9ffb1" 'https://192.168.0.100:6443/healthz?timeout=32s'
I0828 17:12:47.780492   28675 round_trippers.go:405] GET https://192.168.0.100:6443/healthz?timeout=32s  in 0 milliseconds
I0828 17:12:47.780500   28675 round_trippers.go:411] Response Headers:
I0828 17:12:48.280824   28675 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubeadm/v1.11.2 (linux/amd64) kubernetes/bb9ffb1" 'https://192.168.0.100:6443/healthz?timeout=32s'
I0828 17:12:48.281238   28675 round_trippers.go:405] GET https://192.168.0.100:6443/healthz?timeout=32s  in 0 milliseconds
I0828 17:12:48.281283   28675 round_trippers.go:411] Response Headers:
I0828 17:12:48.780836   28675 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubeadm/v1.11.2 (linux/amd64) kubernetes/bb9ffb1" 'https://192.168.0.100:6443/healthz?timeout=32s'
I0828 17:12:48.781171   28675 round_trippers.go:405] GET https://192.168.0.100:6443/healthz?timeout=32s  in 0 milliseconds
I0828 17:12:48.781199   28675 round_trippers.go:411] Response Headers:
I0828 17:12:49.281440   28675 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubeadm/v1.11.2 (linux/amd64) kubernetes/bb9ffb1" 'https://192.168.0.100:6443/healthz?timeout=32s'

谁可以帮助我?

1 个答案:

答案 0 :(得分:1)

kubeadm init之后,您应该将 admin.conf 文件复制到将使用kubectl命令的用户的主目录中,并将配置路径设置为{{1 }}系统变量:

KUBECONFIG

这是一个配置文件,sudo cp /etc/kubernetes/admin.conf $HOME/ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf 从中读取与K8s群集建立连接所需的详细信息。