【问题标题】:Why does ES show an error log `readiness probe failed`?为什么 ES 显示错误日志 `readiness probe failed`?
【发布时间】:2021-10-07 09:30:14
【问题描述】:

我正在 AWS EKS 上部署 Elasticsearch 集群。下面是k8s spec yml文件。

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: datasource
spec:
  version: 7.14.0
  nodeSets:
  - name: node
    count: 3
    config:
      node.store.allow_mmap: true
      xpack.security.http.ssl.enabled: false
      xpack.security.transport.ssl.enabled: false
      xpack.security.enabled: false
    podTemplate:
      spec:
        initContainers:
        - name: sysctl
          securityContext:
            privileged: true
          command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
        containers:
        - name: elasticsearch
          readinessProbe:
              exec:
                command:
                - bash
                - -c
                - /mnt/elastic-internal/scripts/readiness-probe-script.sh
              failureThreshold: 3
              initialDelaySeconds: 10
              periodSeconds: 12
              successThreshold: 1
              timeoutSeconds: 12
          env:
          - name: READINESS_PROBE_TIMEOUT
            value: "30"
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: ebs-sc
        resources:
          requests:
            storage: 1024Gi

部署后,我看到三个 pod 都有错误:

{"type": "server", "timestamp": "2021-10-05T05:19:37,041Z", "level": "INFO", "component": "o.e.c.m.MetadataMappingService", "cluster.name": "datasource", "node.name": "datasource-es-node-0", "message": "[.kibana/g5_90XpHSI-y-I7MJfBZhQ] update_mapping [_doc]", "cluster.uuid": "xJ00drroT_CbJPfzi8jSAg", "node.id": "qmtgUZHbR4aTWsYaoIEDEA"  }
{"type": "server", "timestamp": "2021-10-05T05:19:37,622Z", "level": "INFO", "component": "o.e.c.r.a.AllocationService", "cluster.name": "datasource", "node.name": "datasource-es-node-0", "message": "Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.kibana][0]]]).", "cluster.uuid": "xJ00drroT_CbJPfzi8jSAg", "node.id": "qmtgUZHbR4aTWsYaoIEDEA"  }
{"timestamp": "2021-10-05T05:19:40+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:19:45+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:19:50+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:19:55+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:20:00+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:20:05+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:20:10+00:00", "message": "readiness probe failed", "curl_rc": "35"}
{"timestamp": "2021-10-05T05:20:15+00:00", "message": "readiness probe failed", "curl_rc": "35"}

从上面的日志中,它首先显示Cluster health status changed from [YELLOW] to [GREEN] ,然后出现此错误readiness probe failed。我想知道如何解决这个问题。是 Elasticsearch 相关的错误还是 k8s 相关的?

【问题讨论】:

  • node.store.allow_mmap 的设置来看,假设你在同一个工作节点上运行所有 3 个 Pod 进行实验?如果是这样,您可以尝试将就绪探测时间从 5 秒增加到 30 秒。
  • 我有 3 个节点,由 k8s 决定 es pod 在哪个节点上运行。当我使用elasticsearch.k8s.elastic.co/v1 时,它是否允许我更新readiness probe?检查了他们的文档,但似乎不支持此配置:elastic.co/guide/en/cloud-on-k8s/1.0/…

标签: elasticsearch kubernetes


【解决方案1】:

您可以在您的规范中声明 READINESS_PROBE_TIMEOUT,例如 this

...
env:
- name: READINESS_PROBE_TIMEOUT
  value: "30"

如有必要,您可以自定义就绪探测,最新的 elasticsearch.k8s.elastic.co/v1 API 规范是 here,它与您可以在 Elasticsearch 规范中使用的 K8s PodTemplateSpec 相同。

更新:curl 错误代码 35 是指 SSL 错误。这是post regarding the script。您能否从规范中删除以下设置并重新运行:

xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.enabled: false

【讨论】:

  • 我已经尝试过,但仍然遇到同样的错误。我已经更新了我的问题中的最新规范。
  • 就绪探测的默认协议使用https,查看更新的答案并尝试一下?
  • 如果我删除这些配置,我会收到此错误:received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/10.0.2.155:9200, remoteAddress=/10.0.2.237:40206
  • 此错误与默认由ECK提供的SSL证书有关,还是您指定了自己的证书?建议使用更新的规范重新创建集群。
  • 不,我没有证书。所有流量都在 VPC 内运行,该 VPC 仅在 http 上运行。有没有办法让它在 http 中工作?
猜你喜欢
  • 2020-07-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-12
  • 2012-03-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多