Helm3安装ElasticSearch和Kibana

前言 因为自己的网站要做全文检索功能,本身我是使用mongodb做为数据库的,但是考虑到后期数据量非常大而且用户体验也要跟上,所以准备入手elasticsearch做为我的站内搜索,现分享给大家。
安装 看过我文章的小伙伴应该知道,之前已经使用过helm3安装过redis、rabbitmq,所以套路都是一样的,我们先来搜索elasticsearch和kibana。
命令:

helm search repo elasticsearch helm search repo kibana

输出:
NAMECHART VERSIONAPP VERSIONDESCRIPTION bitnami/elasticsearch18.2.98.2.2Elasticsearch is a distributed search and analy... elastic/elasticsearch7.17.37.17.3Official Elastic helm chart for Elasticsearch stable/elasticsearch1.32.56.8.6DEPRECATED Flexible and powerful open source, d... stable/elasticsearch-curator2.2.35.7.6DEPRECATED A Helm chart for Elasticsearch Curator stable/elasticsearch-exporter3.7.01.1.0Elasticsearch stats exporter for Prometheus bitnami/dataplatform-bp212.0.31.0.1This Helm chart can be used for the automated d... bitnami/grafana7.6.58.3.4Grafana is an open source, feature rich metrics... bitnami/kibana10.1.98.2.2Kibana is an open source, browser based analyti... elastic/eck-operator2.2.02.2.0A Helm chart for deploying the Elastic Cloud on... stable/apm-server2.1.77.0.0DEPRECATED The server receives data from the El... stable/dmarc2logstash1.3.11.0.3DEPRECATED Provides a POP3-polled DMARC XML rep... stable/elastabot1.2.11.1.0DEPRECATED A Helm chart for Elastabot - a Slack... stable/elastalert1.5.10.2.4DEPRECATED ElastAlert is a simple framework for... stable/fluentd2.5.3v2.4.0DEPRECATED A Fluentd Elasticsearch Helm chart f... stable/kibana3.2.76.7.0Kibana is an open source data visualization plu... elastic/eck-operator-crds2.2.02.2.0A Helm chart for installing the ECK operator Cu...

NAMECHART VERSIONAPP VERSIONDESCRIPTION bitnami/kibana10.1.98.2.2Kibana is an open source, browser based analyti... elastic/kibana7.17.37.17.3Official Elastic helm chart for Kibana stable/kibana3.2.76.7.0Kibana is an open source data visualization plu... elastic/eck-operator2.2.02.2.0A Helm chart for deploying the Elastic Cloud on... bitnami/dataplatform-bp212.0.31.0.1This Helm chart can be used for the automated d... elastic/eck-operator-crds2.2.02.2.0A Helm chart for installing the ECK operator Cu...

然后找到自己想要的repo拉下来,比如我这里选用的是bitnami/elasticsearch和bitnami/kibana,接着输入以下命令:
命令:
helm pull bitnami/elasticsearch helm pull bitnami/kibana

下载下来之后,我们先打开elasticsearch的values.yaml文件,查阅之后,我们设置我们想要的配置如下所示:
elasticsearch values.yaml
global: storageClass: "alicloud-cnfs-nas" elasticsearch: service: name: elasticsearch ports: restAPI: 9200 kibanaEnabled: false service: type: NodePort master: replicaCount: 1 data: replicaCount: 1 coordinating: replicaCount: 1 ingest: replicaCount: 1

注意:因为我使用的是阿里云的K8S所以storageClass我用的是alicloud-cnfs,之前文章有说过如何安装,有兴趣的可以前去查看,之后副本我都使用的是1,原因也是想节约资源。
配置好之后,接下来我们来安装,命令如下:
helm install -f test-values.yaml test-elasticsearch bitnami/elasticsearch --namespace elasticsearch

输出:
NAME: test-elasticsearch LAST DEPLOYED: Wed Jun 15 10:11:40 2022 NAMESPACE: elasticsearch STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: CHART NAME: elasticsearch CHART VERSION: 18.2.10 APP VERSION: 8.2.2------------------------------------------------------------------------------- WARNINGElasticsearch requires some changes in the kernel of the host machine to work as expected. If those values are not set in the underlying operating system, the ES containers fail to boot with ERROR messages.More information about these requirements can be found in the links below:https://www.elastic.co/guide/en/elasticsearch/reference/current/file-descriptors.html https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.htmlThis chart uses a privileged initContainer to change those settings in the Kernel by running: sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536** Please be patient while the chart is being deployed **Elasticsearch can be accessed within the cluster on port 9200 at test-elasticsearch.elasticsearch.svc.cluster.localTo access from outside the cluster execute the following commands:export NODE_PORT=$(kubectl get --namespace elasticsearch -o jsonpath="{.spec.ports[0].nodePort}" services test-elasticsearch) export NODE_IP=$(kubectl get nodes --namespace elasticsearch -o jsonpath="{.items[0].status.addresses[0].address}") curl http://$NODE_IP:$NODE_PORT/

这样就安装好了,接下来,我们通过以下命令来获取IP和PORT目的是访问我们已经安装好的elasticsearch
# 获取端口 kubectl get --namespace elasticsearch -o jsonpath="{.spec.ports[0].nodePort}" services test-elasticsearch# 获取IP kubectl get nodes --namespace elasticsearch -o jsonpath="{.items[0].status.addresses[0].address}"

完成获取之后,我们把地址打开会出现如下显示,则证明安装成功。
{ "name" : "test-elasticsearch-coordinating-0", "cluster_name" : "elastic", "cluster_uuid" : "fd9jc0k3QY2E5wYHgcGNbA", "version" : { "number" : "8.2.2", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "9876968ef3c745186b94fdabd4483e01499224ef", "build_date" : "2022-05-25T15:47:06.259735307Z", "build_snapshot" : false, "lucene_version" : "9.1.0", "minimum_wire_compatibility_version" : "7.17.0", "minimum_index_compatibility_version" : "7.0.0" }, "tagline" : "You Know, for Search" }

安装好之后,接下来我们安装kibana,跟安装elasticsearch类似,我们配置一下pull 下来的values.yaml文件
service: type: NodePort elasticsearch: hosts: [your-elasticsearch-ip] port: your-elasticsearch-port persistence: storageClass: "alicloud-cnfs-nas" size: 10Gi

配置完之后,我们执行一下命令:
helm install -f test-values.yaml test-kibana bitnami/kibana --namespace elasticsearch

输出:
NAME: test-kibana LAST DEPLOYED: Wed Jun 15 21:55:26 2022 NAMESPACE: elasticsearch STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: CHART NAME: kibana CHART VERSION: 10.1.9 APP VERSION: 8.2.2** Please be patient while the chart is being deployed **1. Get the application URL by running these commands: export NODE_PORT=$(kubectl get --namespace elasticsearch -o jsonpath="{.spec.ports[0].nodePort}" services test-kibana) export NODE_IP=$(kubectl get nodes --namespace elasticsearch -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORTWARNING: Kibana is externally accessible from the cluster but the dashboard does not contain authentication mechanisms. Make sure you follow the authentication guidelines in your Elastic stack. +info https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-up-authentication.html

这样就安装好了,接下来,我们通过以下命令来获取IP和PORT目的是访问我们已经安装好的elasticsearch
# 获取端口 kubectl get --namespace elasticsearch -o jsonpath="{.spec.ports[0].nodePort}" services test-kibana# 获取IP kubectl get nodes --namespace elasticsearch -o jsonpath="{.items[0].status.addresses[0].address}"

完成获取之后,我们把地址打开会出现如下显示,则证明安装成功,现在开始你的elasticsearch之旅吧。
Helm3安装ElasticSearch和Kibana
文章图片

总结 【Helm3安装ElasticSearch和Kibana】1、bitnami/elasticsearch已经集成了kibana,就看你想使用集成的还是独立的了
引用 Springboot + ElasticSearch 构建博客检索系统

    推荐阅读