我按照快速入门教程在 Kubernetes 上设置 elasticsearch。 将它安装在预先创建的命名空间上,而不是默认的。
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: my-cluster
namespace: test-cluster
spec:
version: 7.10.1
nodeSets:
- name: default
count: 3
config:
node.master: true
node.data: true
node.ingest: true
node.store.allow_mmap: false
现在在我设置的 filebeat-kubernetes.yaml 中:
env:
- name: ELASTICSEARCH_HOST
value: my-cluster-es-http
- name: ELASTICSEARCH_PORT
value: "9200"
- name: ELASTICSEARCH_USERNAME
value: elastic
- name: ELASTICSEARCH_PASSWORD
value: xxxxxxxxx
- name: ELASTIC_CLOUD_ID
value:
当我进行端口转发时:
kubectl 端口转发服务/my-cluster-es-http 9200 -n test-cluster
连接成功, 当我这样做
curl -u "elastic:xxxxxxI" -k "https://localhost:9200"
我得到:
{
"name" : "my-cluster-es-default-0",
"cluster_name" : "my-cluster",
"cluster_uuid" : "fAD43yyaxxxmMTJ-eNVQ",
"version" : {
"number" : "7.10.1",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "1c34507e6xxxf66f3513706fdf548736aa",
"build_date" : "2020-12-05T01:00:33.671820Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
但是当我从豆荚卷曲到豆荚时
curl -u "elastic:xxxxxx" -k "https://my-cluster-es-http:9200"
我得到:
Could not resolve host: my-cluster-es-http
但是当我查看其中一个 filebeat pod 时:
WARN [transport] transport/tcp.go:52 DNS lookup failure "my-cluster-es-http": lookup my-cluster-es-http on 1xx.xx.xx.xx:53: no such host
2021-01-05T07:14:42.235Z INFO [monitoring] log/log.go:145 Non-zero metrics in the last 30s {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":400,"time":{"ms":3}},"total":{"ticks":2320,"time":{"ms":20},"value":2320},"user":{"ticks":1920,"time":{"ms":17}}},"handles":{"limit":{"hard":1048576,"soft":1048576},"open":18},"info":{"ephemeral_id":"73c04f40-060f-414c-9609-6ce2994a4b45","uptime":{"ms":1410067}},"memstats":{"gc_next":62182912,"memory_alloc":32397640,"memory_total":129484856},"runtime":{"goroutines":83}},"filebeat":{"harvester":{"open_files":8,"running":17}},"libbeat":{"config":{"module":{"running":0}},"pipeline":{"clients":1,"events":{"active":4117,"retry":50}}},"registrar":{"states":{"current":7}},"system":{"load":{"1":0.31,"15":0.14,"5":0.26,"norm":{"1":0.0388,"15":0.0175,"5":0.0325}}}}}}
2021-01-05T07:15:06.918Z ERROR [publisher_pipeline_output] pipeline/output.go:154 Failed to connect to backoff(elasticsearch(http://my-cluster-es-http:9200)): Get "http://my-cluster-es-http:9200": lookup my-cluster-es-http on 1xx.xx.xx.xx:53: no such host
2021-01-05T07:15:06.919Z INFO [publisher_pipeline_output] pipeline/output.go:145 Attempting to reconnect to backoff(elasticsearch(http://my-cluster-es-http:9200)) with 37 reconnect attempt(s)
2021-01-05T07:15:06.919Z INFO [publisher] pipeline/retry.go:219 retryer: send unwait signal to consumer
因此在 kibana 中没有得到任何东西 我在这里缺少什么? 谢谢