因为启动dashboard报CrashLoopBackOff错误,尝试使用logs去查看日志,结果报错,错误如下:
[iyunv@localhost ~]# kubectl -s http://192.168.37.130:8080 logs kubernetes-dashboard-v1.4.0-vceyf --namespace=kube-system
Using HTTP port: 9090
Using apiserver-host location: http://127.0.0.1:8080
Creating API server client for http://127.0.0.1:8080
Error while initializing connection to Kubernetes apiserver. This most likely means that the cluster is misconfigured (e.g., it has invalid apiserver certificates or service accounts configuration) or the --apiserver-host param points to a server that does not exist. Reason: Get http://127.0.0.1:8080/version: dial tcp 127.0.0.1:8080: getsockopt: connection refused
但是使用curl http://192.168.37.130:8080却是可以访问通的
[iyunv@localhost ~]# curl http://192.168.37.130:8080
{
"paths": [
"/api",
"/api/v1",
...."/version"
]
}[iyunv@localhost ~]#
实在很奇怪,
首先怀疑是不是因为IPV6的原因导致,关闭IPV6
编辑文件/etc/sysctl.conf,
vi /etc/sysctl.conf
添加下面的行:
net.ipv6.conf.all.disable_ipv6
=1
net.ipv6.conf.default.disable_ipv6
=1
如果你想要为特定的网卡禁止IPv6,比如,对于enp0s3,添加下面的行。
net.ipv6.conf.enp0s3.disable_ipv6
=1
保存并退出文件。
执行下面的命令来使设置生效。
sysctl
-p
但再次重启服务,也还是无法访问,原因不在此。
从网上看这篇文章:http://blog.csdn.net/qingchi0/article/details/42538549,说
监听的接口,如果配置为127.0.0.1则只监听localhost,配置为0.0.0.0会监听所有接口,这里配置为0.0.0.0。
尝试进行修改
把前文安装kube-apiserver的配置文件/etc/sysconfig/kubernets/kube-apiserver修改为
INSECURE_BIND_ADDRESS="--insecure-bind-address=0.0.0.0"
重启服务,发现这次连本来能访问的localhost:8080都访问不通了,说明无效,再次尝试将INSECURE_BIND_ADDRESS改为
INSECURE_BIND_ADDRESS="--address=0.0.0.0"
重启服务,
curl 127.0.0.1:8080
curl localhost:8080
curl 192.168.37.130:8080
三种方式访问都么有问题。
本以为按照127.0.0.1能够访问通了,kubectl -s http://192.168.37.130:8080 logs kubernetes-dashboard-v1.4.0-vceyf --namespace=kube-system就能看到结果了,但结果依旧,那么就应该是提示中的另外一个问题了,
This most likely means that the cluster is misconfigured (e.g., it has invalid apiserver certificates or service accounts configuration)
这个就应该是证书的问题了,这个问题比较复杂,后面在系统的去研究下
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com