k8s-云原生-on-讲解与实战操作-Kibana-Elasticsearch (k8s云原生)

教程大全 2025-07-16 16:35:05 浏览

「云原生」Elasticsearch + Kibana on k8s 讲解与实战操作

2022-10-14 07:42:50Elasticsearch是一个基于Lucene的搜索引擎。它提供了具有HTTP Web界面和无架构JSON文档的分布式,多租户能力的全文搜索引擎。

一、概述

Elasticsearch是一个基于Lucene的搜索引擎。它提供了具有HTTP Web界面和无架构JSON文档的分布式,多租户能力的全文搜索引擎。Elasticsearch是用Java开发的,根据Apache许可条款作为开源发布。

官方文档:https://gitHub.com/elastic/elasticsearch

二、Elasticsearch 编排部署

地址:

1)添加源并下载编排部署包

helm repo add elastic httpshelmhelm pull elasticelasticsearch tar xf elasticsearch

2)构建镜像

Elasticsearch 各版本下载地址:这里就不重新构建镜像了,这里是将远程的镜像推送到我们本地harbor,加速拉取镜像。

docker pull dockerelasticsearchelasticsearchdocker tag dockerelasticsearchelasticsearchmyharborbigdataelasticsearch# 上传镜像docker push myharborbigdataelasticsearch# 删除镜像docker rmi myharborbigdataelasticsearchcrictl rmi myharborbigdataelasticsearch

3)修改yaml编排

image......### 去掉这几行volumeClaimTemplateaccessModesresourcesrequestsstorageGi....persistenceenabledlabels# Add default labels for the volumeClaimTemplate of the StatefulSetenableDannotationsaccessModes ReadWriteOncesizeGistorageClasslocal name elasticsearchhostpath name elasticsearchhostpath name elasticsearchhostpath...protocol httphttpPorttransportPortserviceenabledtype NodePortnodePorthttpPortName
kind StorageClassapiVersion storagev1metadatanameprovisioner kubernetesnoprovisioner
{{- range .Values.persistence.local }}---apiVersion: v1kind: PersistentVolumemetadata:name: {{ .name }}labels:name: {{ .name }}spec:storageClassName: {{ $.Values.persistence.storageClass }}capacity:storage: {{ $.Values.persistence.size }}accessModes:{{- range $.Values.persistence.accessModes }}- {{ . | quote }}{{- end }}local:path: {{ .path }}nodeAffinity:required:nodeSelectorTerms:- matchExpressions:- key: kubernetes.io/hostnameoperator: Invalues:- {{ .host }}---{{- end }}
spec:volumeClaimTemplates:spec:# 去掉这行{{ toYaml .Values.volumeClaimTemplate | indent 6 }}# 新增以下内容:accessModes:{{- range .Values.persistence.accessModes }}- {{ . | quote }}{{- end }}resources:requests:storage: {{ .Values.persistence.size | quote }}{{- if .Values.persistence.storageClass }}{{- if (eq "-" .Values.persistence.storageClass) }}storageClassName: ""{{- else }}storageClassName: "{{ .Values.persistence.storageClass }}"{{- end }}{{- end }}

4)开始部署

# 先创建本地存储目录mkdir p optbigdataserverselasticsearchdatadata1chmod R optbigdataserverselasticsearchdatadata1helm install myelasticsearch .elasticsearch n elasticsearch # 查看helm get notes myelasticsearch n elasticsearchkubectl get podssvc n elasticsearch owide
NAME myelasticsearchLAST DEPLOYED Wed Oct NAMESPACE elasticsearchSTATUS deployedREVISIONNOTES. Watch all cluster members come up.$ kubectl get pods $ helm 

5)测试验证

curl http_catnodescurl http_cathealth?pretty

6)elasticsearch-head

elasticsearch-head GitHub下载地址:浏览器 elasticsearch-head插件:

链接:提取码:67v4

7)卸载

helm uninstall myelasticsearch n elasticsearchkubectl  ns elasticsearch rm fr optbigdataserverselasticsearchdatadata1

三、Kibana 编排部署

地址:

1)添加源并下载编排部署包

helm repo add bitnamipull bitnami/kibana --version 10.2.6tar -xf kibana-10.2.6.tgz

2)构建镜像

k8s

这里也不重新构建镜像了,只是将镜像推送到本地harbor加速,【注意】版本号需要跟ES相对应,版本不一样,可能会存储不兼容的情况。

docker pull docker.io/bitnami/kibana:7.17.3docker tag docker.io/bitnami/kibana:7.17.3 myharbor.com/bigdata/kibana:7.17.3# 上传镜像docker push myharbor.com/bigdata/kibana:7.17.3# 删除镜像docker rmi myharbor.com/bigdata/kibana:7.17.3crictl rmi myharbor.com/bigdata/kibana:7.17.3

3)修改yaml编排

image:registry: myharbor.comrepository: bigdata/kibanatag: 8.4.3-debian-11-r1...replicaCount: 1...persistence:enabled: trueaccessModes:- ReadWriteOncesize: 1GistorageClass: "kibana-local-storage"local:- name: kibana-0host: "local-168-182-111"path: "/opt/bigdata/servers/kibana/data/data1"...service:ports:http: 5601type: NodePortnodePorts:http: "30601"...elasticsearch:hosts:- elasticsearch-master.elasticsearchport: "9200"
{{- range .Values.persistence.local }}---apiVersion: v1kind: PersistentVolumemetadata:name: {{ .name }}labels:name: {{ .name }}spec:storageClassName: {{ $.Values.persistence.storageClass }}capacity:storage: {{ $.Values.persistence.size }}accessModes:{{- range $.Values.persistence.accessModes }}- {{ . | quote }}{{- end }}local:path: {{ .path }}nodeAffinity:required:nodeSelectorTerms:- matchExpressions:- key: kubernetes.io/hostnameoperator: Invalues:- {{ .host }}---{{- end }}
kind: StorageClassapiVersion: storage.k8s.io/v1metadata:name: {{ .Values.persistence.storageClass }}provisioner: kubernetes.io/no-provisioner
{{- range .Values.persistence.local }}---apiVersion: v1kind: PersistentVolumemetadata:name: {{ .name }}labels:name: {{ .name }}spec:storageClassName: {{ $.Values.persistence.storageClass }}capacity:storage: {{ $.Values.persistence.size }}accessModes:{{- range $.Values.persistence.accessModes }}- {{ . | quote }}{{- end }}local:path: {{ .path }}nodeAffinity:required:nodeSelectorTerms:- matchExpressions:- key: kubernetes.io/hostnameoperator: Invalues:- {{ .host }}---{{- end }}

4)开始部署

# 先创建本地存储目录mkdir -p /opt/bigdata/servers/kibana/data/data1chmod -R 777 /opt/bigdata/servers/kibana/data/data1helm install my-kibana ./kibana -n kibana --create-namespace# 查看helm get notes my-kibana -n kibana kubectl get pods,svc -n kibana -owide
NAME: my-kibanaLAST DEPLOYED: Thu Oct 13 22:43:30 2022NAMESPACE: kibanaSTATUS: deployedREVISION: 1TEST SUITE: NoneNOTES:CHART NAME: kibanaCHART VERSION: 10.2.6APP VERSION: 8.4.3** PlEase be patient while the chart is being deployed **######################################################################################################### ERROR: You did not provide the Elasticsearch external host or port in your 'helm install' call #########################################################################################################Complete your Kibana deployment by running:helm upgrade --namespace kibana my-kibana my-repo/kibana \--set elasticsearch.hosts[0]=YOUR_ES_HOST,elasticsearch.port=YOUR_ES_PORTReplacing "YOUR_ES_HOST" and "YOUR_ES_PORT" placeholders by the proper values of your Elasticsearch deployment.

5)测试验证

web:

6)卸载

helm uninstall my-kibana -n kibanakubectl delete ns kibana --forcessh local-168-182-111 rm -fr /opt/bigdata/servers/kibana/data/data1/*docker rmi myharbor.com/bigdata/bigdata:8.4.3-debian-11-r1crictl rmi myharbor.com/bigdata/bigdata:8.4.3-debian-11-r1

elasticsearch-on-k8s

下载地址:

下载地址:


先说刷怪:怪有特点:第一防御低,第二智商低!所以说刷怪呢,只要把你所有攻击性的技能用,在短时间内杀死它,就可以了!再说PK:PK近战门派技能展示——画地为牢——诛仙阵+八阵图——画地消失后——高山流水引爆——鳞波微步走开一段距离——放阵+所有杀人技能——画地——循环就好!PK近站门派所不同的就是,我们的鳞波微步不是用来逃走,而是用来接近对方,然后放阵!

本文版权声明本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请联系本站客服,一经查实,本站将立刻删除。

发表评论

热门推荐