安装kubernetes dashboard时开发环境,运行gulp local-up-cluster任务一直显示wating for a heapster

问题

按照官方教程搭建dashboard的开发环境,运行“gulp local-up-cluster”任务,一直不断显示“waiting for a heapster…”,日志如下:

...
[16:37:22] Finished 'spawn-cluster' after 670 ms
...
[16:37:22] Finished 'wait-for-cluster' after 1.06 s
[16:37:33] Waiting for a Heapster ...
[16:37:43] Waiting for a Heapster ...
[16:37:53] Waiting for a Heapster ...
...

系统环境是:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

kubernetes dashboard的版本是:

v1.6.1

时间:2017.5.19 16:47

原因

这是因为conf.js 文件的 heapsterServerHost项配置错误,其有可能为空,导致wait-for-heapster任务陷入一个死循环。

我们看conf.js文件的配置:

heapsterServerHost:
    gulpUtil.env.heapsterServerHost !== undefined ? gulpUtil.env.heapsterServerHost : '',

当 gulpUtil.env.heapsterServerHost 没有定义时,它就会返回一个空值,从而wait-for-heapster任务的检查函数——heapsterHealthCheck函数一直出错,所以,wait-for-heapster任务就会一直打印出“waiting for a heapster…”,实际上此时 heapsterServer 可能已经运行起来了。

解决办法

可以使用下面这两种方法解决:

  • 直接忽略
  • 修改conf.js文件

直接忽略

heapsterHealthCheck函数是用来检查 heapster server 运行起来没有的,而 heapster server 默认运行在8082端口,所以,我们可以:

lsof -i:8082

如果打印出:

COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
heapster 1618 root    7u  IPv6 2382671      0t0  TCP *:8082 (LISTEN)

说明heapster server已经运行起来了,那么就可以直接按 ctrl+c结束local-up-cluster任务,继续下一步。

修改conf.js

打开conf.js 文件,修改:

heapsterServerHost:
    gulpUtil.env.heapsterServerHost !== undefined ? gulpUtil.env.heapsterServerHost : '',

为:

heapsterServerHost:
    gulpUtil.env.heapsterServerHost !== undefined ? gulpUtil.env.heapsterServerHost : '127.0.0.1:8082',

然后再次运行local-up-cluster任务:

gulp local-up-cluster

猜你喜欢

转载自blog.csdn.net/ruangong1203/article/details/72547951