naftis icon indicating copy to clipboard operation
naftis copied to clipboard

在kubernetes中启动,看不到服务。

Open shihaiyang-world opened this issue 5 years ago • 19 comments

在k8s 中启动的。 版本: image: sevennt/naftis-api:0.1.4-rc5

遇到问题: service中没有数据,个数为0

istio的服务显示正常。

请问需要配置什么吗?还是默认会收集service信息。

shihaiyang-world avatar Jan 07 '19 09:01 shihaiyang-world

@csdnshyang 你的 k8s 中目前有正在运行的服务么,比如 Istio 的示例 Bookinfo。

sevennt avatar Jan 07 '19 11:01 sevennt

我的也是同样的问题 image image

shancang avatar Jan 08 '19 05:01 shancang

@shancang 总的服务数和总的 Pod 数,计算时时排除了 istio-systemkube-systemnaftis 这三个 namespace,见 #23

如果这个查询不到服务和 Pod,需要先确认下 k8s 中已经部署了除 istio-systemkube-systemnaftis 以外的业务服务,比如 Bookinfo。

sevennt avatar Jan 08 '19 06:01 sevennt

@shancang 总的服务数和总的 Pod 数,计算时时排除了 istio-systemkube-systemnaftis 这三个 namespace,见 #23

如果这个查询不到服务和 Pod,需要先确认下 k8s 中已经部署了除 istio-systemkube-systemnaftis 以外的业务服务,比如 Bookinfo。

k8s集群里有许多服务。

kc get svc --all-namespaces |wc -l
     395
kc get svc -n istio-system |wc -l
      10
kc get svc -n naftis |wc -l
       4
kc get svc -n kube-system |wc -l
       8
kc get svc -n zelda |wc -l
     131

k8s里开了认证,但是应该不是这个问题,毕竟istio相关的svc能扫到。

shihaiyang-world avatar Jan 08 '19 11:01 shihaiyang-world

@csdnshyang 你的 k8s 中目前有正在运行的服务么,比如 Istio 的示例 Bookinfo。

Bookinfo的我去掉了。但是我自己做了一批spring boot的服务。 就是gated-launch-* 的几个服务。

shihaiyang-world avatar Jan 08 '19 11:01 shihaiyang-world

111111

统计4xx 5xx的流量中可以看到服务的痕迹。

shihaiyang-world avatar Jan 08 '19 11:01 shihaiyang-world

@shancang 总的服务数和总的 Pod 数,计算时时排除了 istio-systemkube-systemnaftis 这三个 namespace,见 #23

如果这个查询不到服务和 Pod,需要先确认下 k8s 中已经部署了除 istio-systemkube-systemnaftis 以外的业务服务,比如 Bookinfo。

#23 #14 都看了。就是按照时候需不需要做什么配置啊。默认的就能扫到所有的service吗。 mysql那个pod里的表就3张,是不是有问题。

 ✘  ~  kc get po -n naftis
NAME                            READY     STATUS    RESTARTS   AGE
naftis-api-6fd57564db-zv48b     1/1       Running   1          1d
naftis-mysql-799554c7f9-4krw2   1/1       Running   0          1d
naftis-mysql-test               0/1       Error     0          1d
naftis-ui-8d6fcc85f-mwvkq       1/1       Running   0          1d

naftis-mysql-test 的logs

1..1
not ok 1 Testing MySQL Connection
 (in test file /tests/run.sh, line 2)
   `mysql --host=naftis-mysql --port=3306 -u root -pWlRncGh3UWY5VQ==' failed
 mysql: [Warning] Using a password on the command line interface can be insecure.
 ERROR 2003 (HY000): Can't connect to MySQL server on 'naftis-mysql' (110)

naftis-mysql 中的表

show tables;
+------------------+
| Tables_in_naftis |
+------------------+
| task_tmpl_vars   |
| task_tmpls       |
| tasks            |
+------------------+
3 rows in set (0.00 sec)

我猜测是安装过程中出现什么问题了,可能是DNS的问题?

shihaiyang-world avatar Jan 09 '19 02:01 shihaiyang-world

@csdnshyang 连不上 MySQL,delete 掉 naftis-api,让它重启下试试。

sevennt avatar Jan 09 '19 02:01 sevennt

@sevennt 删除了naftis-api ,结果没有变化。看naftis-api的log,init db success。

kc logs -f naftis-api-6fd57564db-nnxmd -n naftis
APP]> (1) 2019-01-09 03:39:32 [INFO]  [Args] Host:0.0.0.0
APP]> (1) 2019-01-09 03:39:32 [INFO]  [Args] Port:50000
APP]> (1) 2019-01-09 03:39:32 [INFO]  [Args] InCluster:true
APP]> (1) 2019-01-09 03:39:32 [INFO]  [Args] ConfigFile:/etc/naftis/config/config.toml
APP]> (1) 2019-01-09 03:39:32 [INFO]  [Args] Namespace:naftis
APP]> (1) 2019-01-09 03:39:32 [INFO]  [Args] IstioNamespace:istio-system

2019-01-09T03:39:32.047716Z	info	[GIN-debug] [WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.
2019-01-09T03:39:32.047899Z	info	[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
2019-01-09T03:39:32.047926Z	info	[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:	export GIN_MODE=release
 - using code:	gin.SetMode(gin.ReleaseMode)
2019-01-09T03:39:32.051820Z	info	[GIN-debug] GET    /api/probe/healthy        --> github.com/xiaomi/naftis/src/api/handler.Healthy (4 handlers)
2019-01-09T03:39:32.051852Z	info	[GIN-debug] POST   /api/login/account        --> github.com/xiaomi/naftis/src/api/handler.LoginAccount (4 handlers)
2019-01-09T03:39:32.051877Z	info	[GIN-debug] GET    /api/login_user           --> github.com/xiaomi/naftis/src/api/handler.LoginUser (5 handlers)
2019-01-09T03:39:32.051891Z	info	[GIN-debug] GET    /api/diagnose             --> github.com/xiaomi/naftis/src/api/handler.ListStatus (5 handlers)
2019-01-09T03:39:32.051909Z	info	[GIN-debug] GET    /api/metrics              --> github.com/xiaomi/naftis/src/api/handler.ListMetrics (5 handlers)
2019-01-09T03:39:32.051922Z	info	[GIN-debug] GET    /api/d3graph              --> github.com/xiaomi/naftis/src/api/handler.D3Graph (5 handlers)
2019-01-09T03:39:32.051943Z	info	[GIN-debug] GET    /api/services             --> github.com/xiaomi/naftis/src/api/handler.Services (5 handlers)
2019-01-09T03:39:32.051955Z	info	[GIN-debug] GET    /api/services/:uid        --> github.com/xiaomi/naftis/src/api/handler.Services (5 handlers)
2019-01-09T03:39:32.051979Z	info	[GIN-debug] GET    /api/services/:uid/pods   --> github.com/xiaomi/naftis/src/api/handler.ServicePods (5 handlers)
2019-01-09T03:39:32.051994Z	info	[GIN-debug] GET    /api/pods                 --> github.com/xiaomi/naftis/src/api/handler.Pods (5 handlers)
2019-01-09T03:39:32.052012Z	info	[GIN-debug] GET    /api/pods/:name           --> github.com/xiaomi/naftis/src/api/handler.Pods (5 handlers)
2019-01-09T03:39:32.052024Z	info	[GIN-debug] GET    /api/tasks                --> github.com/xiaomi/naftis/src/api/handler.ListTasks (5 handlers)
2019-01-09T03:39:32.052048Z	info	[GIN-debug] GET    /api/tasks/:id            --> github.com/xiaomi/naftis/src/api/handler.ListTasks (5 handlers)
2019-01-09T03:39:32.052064Z	info	[GIN-debug] POST   /api/tasks                --> github.com/xiaomi/naftis/src/api/handler.AddTasks (5 handlers)
2019-01-09T03:39:32.052081Z	info	[GIN-debug] GET    /api/tasktmpls            --> github.com/xiaomi/naftis/src/api/handler.ListTaskTmpls (5 handlers)
2019-01-09T03:39:32.052102Z	info	[GIN-debug] GET    /api/tasktmpls/:id        --> github.com/xiaomi/naftis/src/api/handler.ListTaskTmpls (5 handlers)
2019-01-09T03:39:32.052118Z	info	[GIN-debug] POST   /api/tasktmpls            --> github.com/xiaomi/naftis/src/api/handler.AddTaskTmpls (5 handlers)
2019-01-09T03:39:32.052139Z	info	[GIN-debug] PUT    /api/tasktmpls/:id        --> github.com/xiaomi/naftis/src/api/handler.UpdateTaskTmpls (5 handlers)
2019-01-09T03:39:32.052150Z	info	[GIN-debug] DELETE /api/tasktmpls/:id        --> github.com/xiaomi/naftis/src/api/handler.DeleteTaskTmpls (5 handlers)
2019-01-09T03:39:32.052170Z	info	[GIN-debug] GET    /api/tasktmpls/:id/vars   --> github.com/xiaomi/naftis/src/api/handler.ListTaskTmplVars (5 handlers)
2019-01-09T03:39:32.052182Z	info	[GIN-debug] GET    /api/kube/info            --> github.com/xiaomi/naftis/src/api/handler.Kubeinfo (5 handlers)
2019-01-09T03:39:32.052204Z	info	[GIN-debug] GET    /ws                       --> github.com/xiaomi/naftis/src/api/router.Init.func1 (4 handlers)
[naftis] (1) 2019-01-09 03:39:32 [INFO]  [db] init success
2019-01-09T03:39:32.058964Z	warn	Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
[GIN] 2019/01/09 - 03:40:08 | 200 |      89.329µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:09 | 200 |      53.899µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:18 | 200 |      44.828µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:19 | 200 |      70.034µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:27 | 200 |     224.141µs |    10.6.119.200 | POST     /api/login/account
[GIN] 2019/01/09 - 03:40:28 | 200 |      194.46µs |    10.6.119.200 | GET      /ws?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDcwMDg4MjcsInVzZXJuYW1lIjoiYWRtaW4ifQ.XSBVP20T9ZtBl2iptNMW23dbAynMXfY3AHW3pi-vzbc
[GIN] 2019/01/09 - 03:40:28 | 200 |      161.72µs |    10.6.119.200 | GET      /ws?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDcwMDg4MjcsInVzZXJuYW1lIjoiYWRtaW4ifQ.XSBVP20T9ZtBl2iptNMW23dbAynMXfY3AHW3pi-vzbc
[GIN] 2019/01/09 - 03:40:28 | 200 |      81.027µs |    10.6.119.200 | GET      /api/metrics
[GIN] 2019/01/09 - 03:40:28 | 200 |      49.732µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:29 | 200 |      82.918µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:38 | 200 |     110.507µs |    10.6.119.200 | GET      /api/metrics
[GIN] 2019/01/09 - 03:40:38 | 200 |      45.607µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:39 | 200 |      54.475µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:48 | 200 |     124.487µs |    10.6.119.200 | GET      /api/metrics
[GIN] 2019/01/09 - 03:40:48 | 200 |     146.451µs |    10.6.233.192 | GET      /api/probe/healthy
[GIN] 2019/01/09 - 03:40:49 | 200 |      76.074µs |    10.6.233.192 | GET      /api/probe/healthy

shihaiyang-world avatar Jan 09 '19 03:01 shihaiyang-world

@sevennt 好的,我加一下。

shihaiyang-world avatar Jan 09 '19 07:01 shihaiyang-world

我也是看不到,是0

tmtbe avatar Jan 09 '19 10:01 tmtbe

@tmtbe 稍等,修复中。

sevennt avatar Jan 09 '19 10:01 sevennt

@csdnshyang @tmtbe @shancang 试试 0.1.4-rc6 这个版本。

sevennt avatar Jan 09 '19 11:01 sevennt

@sevennt 经测试问题修复。非常感谢!

shihaiyang-world avatar Jan 09 '19 13:01 shihaiyang-world

已修复,tks

tmtbe avatar Jan 10 '19 02:01 tmtbe

还有,有些功能看不到,比如服务详情,和网络图,都显示不出来

tmtbe avatar Jan 10 '19 02:01 tmtbe

default

显示是空白的

tmtbe avatar Jan 10 '19 02:01 tmtbe

@tmtbe 网络拓扑目前在某些 istio 版本里面显示有问题,后续我们可能会去掉。 服务详情没数据么?可以新开一个 issue。

sevennt avatar Jan 10 '19 08:01 sevennt

@sevennt 网络拓扑图看不到,是哪些版本上是有问题的,哪些版本是ok的,其他的数据都是好的。请问能有什么方式查看是那一部分的问题吗?

caijinhai avatar Feb 27 '19 07:02 caijinhai