Observability:使用 Elastic Agent 来进行 Uptime 监控_elastic agent api-CSDN博客

根据官网文档进行的实践

安装使用同样使用官方的docker-compose来安装的:

Elasticsearch:使用 Docker compose 来一键部署 Elastic Stack 8.x_elastic docker compose-CSDN博客

开始安装Elastic Agent,结果运行fleet server安装脚本的时候报错,感觉还是证书问题

sudo ./elastic-agent install \
  --fleet-server-es=https://192.168.0.3:9200 \
  --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2NjM1NjQxNTY5MzI6TGxhdWtjbmdTSnlYNlBEVkxOQUVJQQ \
  --fleet-server-policy=fleet-server-policy \
  --fleet-server-es-ca-trusted-fingerprint=f77c4413ccc6a034ac9767f12b9f8240bf301ce956ce0d96109a7863c4a33463

根据官方文档生成证书安装:

Encrypt traffic in clusters with a self-managed Fleet Server | Fleet and Elastic Agent Guide [8.1] | Elastic

由于是用docker安装的es集群,所以到docker里去生成这些文件,再拷到宿主机。

./bin/elasticsearch-certutil ca --pem

./bin/elasticsearch-certutil cert \
  --name fleet-server \
  --ca-cert /usr/share/elasticsearch/fleek/ca/ca.crt \
  --ca-key /usr/share/elasticsearch/fleek/ca/ca.key \
  --dns fleet.xxx.com \
  --ip 192.168.20.7 \
  --pem
 

证书都生成拷出来后,在宿主机执行:

sudo ./elastic-agent install -f \
   --url=https://192.168.20.7:8220 \
   --fleet-server-es=https://192.168.20.7:9200 \
   --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE3MjYxOTIzOTQ3NjY6c0NsSDJKVFFSSXU4ODFpTHBCRFVwUQ \
   --fleet-server-es-ca=/var/lib/docker/volumes/es8_certs/_data/ca/ca.crt \
   --certificate-authorities=/data/es-kibana/es8/feek-key/ca/ca.crt \
   --fleet-server-cert=/data/es-kibana/es8/feek-key/fleet-server/fleet-server.crt \
   --fleet-server-cert-key=/data/es-kibana/es8/feek-key/fleet-server/fleet-server.key

--fleet-server-es-ca

CA certificate to use to connect to Elasticsearch.

就是docker-compose安装脚本安装的ca.crt

--certificate-authorities

CA certificate to use to connect to Fleet Server.

就是进docker里./bin/elasticsearch-certutil ca --pem命令生成的ca.crt

安装成功

Logo

更多推荐