因为启动dashboard报CrashLoopBackOff错误,尝试使用logs去查看日志,结果报错,错误如下:

[root@localhost ~]# kubectl -s http://192.168.37.130:8080 logs kubernetes-dashboard-v1.4.0-vceyf --namespace=kube-system
Using HTTP port:
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却是可以访问通的

[root@localhost ~]# curl  http://192.168.37.130:8080
{
"paths": [
"/api",
"/api/v1",
  ...."/version"
]
}[root@localhost ~]#

实在很奇怪,

首先怀疑是不是因为IPV6的原因导致,关闭IPV6

编辑文件/etc/sysctl.conf,
vi /etc/sysctl.conf
添加下面的行:
net.ipv6.conf.all.disable_ipv6 =
net.ipv6.conf.default.disable_ipv6 =
如果你想要为特定的网卡禁止IPv6,比如,对于enp0s3,添加下面的行。
net.ipv6.conf.enp0s3.disable_ipv6 =
保存并退出文件。
执行下面的命令来使设置生效。
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)

这个就应该是证书的问题了,这个问题比较复杂,后面在系统的去研究下

【kubernetes】kubectl logs connection refused的更多相关文章

  1. 【Kubernetes】The connection to the server <master>:6443 was refused - did you specify the right host or port?

    不知道怎么用着用着,使用kubectl 时报错,错误如下: root@R740--:~# kubectl get pod The connection to the server 107.105.13 ...

  2. 【Kubernetes】kube-dns 持续重启

    kuberbetes部署和启动正常,但是kube-dns持续重启 使用命令 kubectl get pods --all-namespaces 得到结果 从图中可以看出kube-dns-c7d8589 ...

  3. 【原创】<Debug> “duplicate connection name”

    [Problem] duplicate connection name [Solution] 在Qt上使用SQLite的时候,如果第二次使用QSqlDatabase::addDatabase()方式时 ...

  4. 【Kubernetes】离线业务:Job与CronJob

    Deployment.StatefulSet和DaemonSet这三个编排概念编排的对象主要都是在线业务(Long Running Task,这些应用一旦运行起来,除非出错或者停止,它的容器进程会一直 ...

  5. 【Kubernetes】容器集群管理常用命令笔记

    一.集群部署-查询集群状态 ①查询k8s master各组件健康状态: kubectl get componentstatus ②查询k8s node健康状态: kubectl get node 二. ...

  6. 【Kubernetes】两篇文章 搞懂 K8s 的 fannel 网络原理

    近期公司的flannel网络很不稳定,花时间研究了下并且保证云端自动部署的网络能够正常work. 1.网络拓扑 拓扑如下:(点开看大图)  容器网卡通过docker0桥接到flannel0网卡,而每个 ...

  7. 【Kubernetes】部署K8s-dashboard v1.10.1

    一.官方kubernetes-dashboard.yaml简介 ①首先认识一下官方的kubernetes-dashboard.yaml,我们先下载: https://github.com/kubern ...

  8. 37 【kubernetes】搭建dashboard

    官方的操作步骤是:https://github.com/kubernetes/dashboard 我自己的步骤是: 1,下载yaml文件 wget https://raw.githubusercont ...

  9. 36 【kubernetes】coredns

    CoreDNS是k8s中,master节点和从节点及其pods之间通信的接口. 但是上个博客中遇到一个问题dns一直处于crush的状态. https://www.cnblogs.com/helww/ ...

随机推荐

  1. HDU 3779 Railroad(记忆化搜索)

    Railroad Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Subm ...

  2. c# 系统校时工具类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HuaT ...

  3. 关于命名空间namespace

    虽然任意合法的PHP代码都可以包含在命名空间中,但只有以下类型的代码受命名空间的影响,它们是:类(包括抽象类和traits).接口.函数和常量. 在声明命名空间之前唯一合法的代码是用于定义源文件编码方 ...

  4. 对map参数进行排序

    /**     * Map转换成url参数 by csl     *     * @param map     * @param isSort 是否排序     * @return     */   ...

  5. java作业调度框架Quartz

    在软件开发中,很多时候需要在特定时间的时间执行某些操作,比如每天的凌晨三点.每周的周日.每个月的15号,Apache Quartz就是一个开源的作业调度框架,可以让计划的程序任务一个预定义的日期和时间 ...

  6. Shell 关闭指定进程

    例如要关闭jupyter-notebook这个进程: - | 说明:管道符“|”用来隔开两个命令,管道符左边命令的输出会作为管道符右边命令的输入. “ps -ef” 查看所有进程 “grep -v g ...

  7. zookeeper 学习命令

    ls /TianheSoft/nodesls /TianheSoft/nodes/localhost_2181-0000000000ls /TianheSoft/propsls /TianheSoft ...

  8. yum源笔记

    1. epel源,使用yum安装htop http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 2 ...

  9. CentOS 6.5 部署 Horizon

    以root用户进行部署,python源也可以使用 http://mirrors.aliyun.com/pypi/simple/ 修改系统 更改SElinux的配置文件 /etc/selinux/con ...

  10. c语言符号常量与常变量的区别?

    <blockquote>定义符号常量:#define PI 3.1415926               //注意后面没有分号 定义常变量  :const float PI=3.1415 ...