4. k8s搭建es集群踩坑记录

63 阅读1分钟

搭建es集群之后查看pod状态,发现一直在重启

image.png describe查看日志,没有什么有用的信息

image.png 去子节点查看日志:journalctl -xeu kubelet

18a886113e5245345ff2cacc8bd4b44.png 这个提示也看不出什么来
查看具体pod的日志,kubectl logs +pod名称,发现关键报错,

bootstrap check failure [1] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap check failure [2] of [3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
bootstrap check failure [3] of [3]: Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log

image.png

1.首先解决第一个报错
vim /etc/sysctl.conf
添加以下内容
vm.max_map_count=262144
2.第二个报错和第三个报错是同一个问题导致的,因为我只改initial_master_nodes发现没有用,解决了第三个问题然后第二个问题也好了,第三个问题解决方案:

xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: /path/to/your/keystore.jks
xpack.security.transport.ssl.truststore.path: /path/to/your/truststore.jks

再次查看pod状态已经好了,日志也没有报错了

image.png