部署kubernetes的过程中的错误解决

由于本人是初学kubernetes,对原理性的知识还没有深入了解,问题也比较肤浅,仅用以参考。

1.在部署etcd集群时,尝试启动etcd1时,出现报错

Apr 12 01:06:49 k8s-master etcd[3092]: health check for peer 618d69366dd8cee3 could not connect: dial tcp 192.168.81.12:2380: getsockopt: connection refused

Apr 12 01:06:49 k8s-master etcd[3092]: health check for peer acd2ba924953b1ec could not connect: dial tcp 192.168.81.60:2380: getsockopt: connection refused

Apr 12 01:06:48 k8s-master etcd[3092]: publish error: etcdserver: request timed out

分析是因为etcd1的配置文件/etc/etcd/etcd.conf中的ETCD_INITIAL_CLUSTER_STATE是new,而在配置中ETCD_INITIAL_CLUSTER写入了etcd2/3的IP:PORT,这时etcd1尝试去连接etcd2、etcd3,但是etcd2、3的etcd服务此时还未启动,因此需要先启动etcd2和3的etcd服务,再去启动etcd1。

2.在初次部署etcd完成后,尝试执行etcdctl cluster-health命令来查询集群的运行状态,但是报错

cluster may be unhealthy: failed to list members

Error:  client: etcd cluster is unavailable or misconfigured; error #0: dial tcp 127.0.0.1:2379: getsockopt: connection refused

; error #1: dial tcp 127.0.0.1:4001: getsockopt: connection refused

error #0: dial tcp 127.0.0.1:2379: getsockopt: connection refused

error #1: dial tcp 127.0.0.1:4001: getsockopt: connection refused

仔细检查后,发现是因为在etcd配置文件中的ETCD_LISTEN_CLIENT_URLS项,只写入了http://192.168.81.60:2379,而没有写入http://127.0.0.1:2379,加入后即可正常查询。

member 618d69366dd8cee3 is healthy: got healthy result from http://192.168.81.12:2379

member acd2ba924953b1ec is healthy: got healthy result from http://192.168.81.60:2379

member f56676081999649a is healthy: got healthy result from http://192.168.81.11:2379

cluster is healthy

3.在启动docker容器时报错

/usr/bin/docker-current: Error response from daemon: shim error: docker-runc not installed on system.

查询了很多文档,但没有什么收获,相关问题主要以英文网页为主,但是分析应该是docker的版本bug,可能是自己下载错了docker版本,更换yum源,卸载当前的docker,重新安装启动,docker容器可以正常运行了

4.创建完成kebernetes dashboard后,发现进入http://IP:8080/ui是相关的提示信息,而不是kebernetes dashboard的页面,检查发现apiserver接入有问题,在master端修改了/etc/kubernetes/apiserver的相关文件KUBE_ADMISSION_CONTROL=”–admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota”

(删除了ServiceAccount)

    原文作者:辉耀辉耀
    原文地址: https://www.jianshu.com/p/40853445b042
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞