ks版本: 2.0.2
k8s版本: 1.13.1
fluent-bit image: kubesphere/fluent-bit:advanced-2.0.0
使用的外置es,可是一直没收到日志,然后看到fluent-bit一直在报这个错,找不到es的dns解析
[ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-es.svc.inside'): Name or service not known
同集群中还有一个kibana,也是配的这个地址,一直是正常解析的……
不知道这个是什么base镜像,exec /bin/sh 进不去,不知道怎么调了==

    mars 请问这是你们外网 es 的地址吗? http://sa-es.svc.inside 是挂了 endpoint 吗,怎么感觉这个路径很奇怪。一般的格式应该是 <service_name>.<namespace_name>.svc:9200

    • mars 回复了此帖

      huanggze 是k8s集群外的地址,之前这个是不对的方式,请忽略。
      后来我加了svc,挂了endpoint,可是问题还存在。
      svc:

       kubectl -n kubesphere-logging-system describe svc sa-ext-es
      Name:              sa-ext-es
      Namespace:         kubesphere-logging-system
      Labels:            <none>
      Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                           {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"sa-ext-es","namespace":"kubesphere-logging-system"},"spec":{"port...
      Selector:          <none>
      Type:              ClusterIP
      IP:                172.43.158.240
      Port:              <unset>  80/TCP
      TargetPort:        9200/TCP
      Endpoints:         10.0.32.41:9200
      Session Affinity:  None
      Events:            <none>

      logging-fluentbit-operator的pod是可以exec进去的,我进去ping了一下,能正常解析出来

      / $ ping sa-ext-es
      PING sa-ext-es (172.43.158.240): 56 data bytes
      ping: permission denied (are you root?)

      但是在fluent-bit里面还是解析不了

      [2019/11/07 09:20:15] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known
      [2019/11/07 09:20:25] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known
      [2019/11/07 09:20:32] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known
      [2019/11/07 09:20:35] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known
      [2019/11/07 09:20:40] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known
      [2019/11/07 09:20:42] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known
      [2019/11/07 09:20:50] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es'): Name or service not known

      huanggze 改成全路径域名也是解析不了

      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known
      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known
      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known
      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known
      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known
      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known
      [2019/11/07 09:44:59] [ warn] net_tcp_fd_connect: getaddrinfo(host='http://sa-ext-es.kubesphere-logging-system.svc'): Name or service not known

        mars fluent-bit 的 base 镜像是要换下,不方便调试。2.1 版本可能来不及,我之前是这么进入 fluent-bit

        # 下载 busybox 到本地
        wget https://busybox.net/downloads/binaries/1.21.1/busybox-x86_64
        chmod 777 busybox-x86_64
        mv busybox-x86_64 busybox
        docker ps | grep fluent-bit
        # 复制 busybox 到 fluent-bit docker 根目录
        docker cp busybox <YOUR_FLUENTBIT_DOCKER_ID>:/
        # 执行 kubectl exec
        kubectl exec -it -n kubesphere-logging-system <YOUR_FLUENTBIT_POD> -c fluent-bit /busybox sh

        你这样进去后截图看看 /fluent-bit/app-config/fluent-bit.conf ,我看看配置。应该还是配置的问题。有些社区用户也是用 endpoint 外挂 es 是成功的。把 endpoint 和 service 的 yaml 也贴上来看看

        /busybox cat /fluent-bit/app-config/fluent-bit.conf
        2 年 后

        原因: 是fluent-bit没有连接到es, 只需要改自定义资源CRD的一个配置就好了。

        1. 进入自定义资源CRD,找到Output并点击进入
        2. 找到es,选择右侧的编辑配置文件,修改spec.es.host 的值修改为正确的IP地址即可(注意不要带http://等前缀)
          修改完毕,等大约12分钟,fluent-bit会自动加载配置密钥,连接到外部ES。

          izerui 估计是kubesphere的一个bug,当按官网说法修改了 ClusterConfigurationks-install 后,es的host并没有自动同步到logging相关的密钥配置中,所以第一次配置日志输出的时候,externalElasticsearchUrl 这个地址一定要写对(正确为机器IP,不要带任何前缀),否则后续就要自己改自定义CRD里面的输出配置了。

          1 年 后

          2022。

          上述这个Bug貌似还是没有解决,简述下今天部署日志系统外挂ES的时候遇到的问题

          • fluent-bit log提示Name or service not known
            1. 修改ClusterConfiguration的对应url,即不带前缀,只填写host。但是如果ES用的https的话,fluent-bit和ES的日志都能看到类似”使用http请求了https网站“类似的warning。我是直接把ES的tls关了
            2. 再修改CRD下的Output配置文件,向上面老哥说的一样修改`spec.es.host`,只带host,不带http(https)
          • dial tcp: lookup http 10.xx.xx.10:53: no such host
            1. 我把ClusterConfiguration的url填了带http的,最后在web页面上的右下角小锤头进入日志系统的时候提示这个报错。参考链接,修改kubesphere-config 这个configmap。确实在host里带了两个http,去掉即可。

          ks 支持对接启用 https 的es,

          在 ClusterConfiguration 中添加

          spec:
            common:
              es:
                externalElasticsearchProtocol: https