2. Use Helm to build a cluster ElasticSearch

Author

Micro letter: tangy8080
E-mail: [email protected]
Updated: 2019-05-24 16:08:53 Friday

Welcome to subscribe to and share my subscription number, occasionally Share Article prepared some of my own learning process within the subscription number
if you find the article error in the reading process, you can add my micro letter tangy8080 feedback. Thanks for your support .

Topic

Helm ElasticSearch use to build a cluster in the cluster k8s

Pre-conditions

  • There is a cluster k8s
  • Built a good NFS server
  • Already installed the Helm

text

Installation nfs-client-provisioner

Helm mounted using nfs-client-provisioner

nfs-client-provisioner NFS is a simple external provisioner Kubernetes itself does not provide NFS, NFS server needs to store the existing

It uses existing NFS server and configured to support dynamic configuration Kubernetes persistent volumes declared by persistent volumes

#这里的nfs.server,nfs.path请更改为自己的地址
helm install --name nfs-client --set nfs.server=192.168.161.180,nfs.path=/usr/share/k8s  stable/nfs-client-provisioner

After a successful installation, storage volumes can be seen in Kanban

[Demand] to delete nfs-client-provisioner installation
helm delete nfs-client

Cluster Installation ElasticSearch

Use Helm installation ElasticSearch
helm install --name elasticsearch --set image.tag=6.7.0,client.replicas=3,cluster.name=kubernetes,data.persistence.storageClass=nfs-client,master.persistence.storageClass=nfs-client stable/elasticsearch
  • kibana version of the same should ElasticSearch version, https: //github.com/elastic/kibana#version-compatibility-with-elasticsearch
  • Here you can specify the number of copies installed in client.replicas
  • Please use the storage class already installed nfs-client
  • Extended information, please refer to https://github.com/helm/charts/tree/master/stable/elasticsearch

After installation you should see


其中*-elasticsearch-discovery服务被声明为无头服务(无集群IP),仅用于ElasticSearch各个节点之间的相互发现

[按需]删除ElasticSearch安装
helm delete elasticsearch 
kubectl delete pvc -l release=elasticsearch,component=data
kubectl delete pvc -l release=elasticsearch,component=master
helm del --purge elasticsearch

测试集群功能

  • 添加一个索引
#ElasticSearch服务地址可以在看板>服务中看到
curl -XPUT 'http://10.254.89.138:9200/testindex'
{"acknowledged":true,"shards_acknowledged":true,"index":"testindex"}
  • 删除索引
#ElasticSearch服务地址可以在看板>服务中看到
curl -XDELETE http://10.254.89.138:9200/testindex
{"acknowledged":true}
  • 常用操作
curl -XDELETE http://10.254.89.138:9200/lamic*
curl 'http://10.254.89.138:9200/_cat/indices?v'

性能调优

  • 负载均衡支持
    A.我们可以为ElasticSearch API使用Nginx提供负载均衡,这里不再说明
    B.使用kube-proxy内置了简单的负载均衡(轮询)

可以看到,在K8s内置的服务发现和kube-proxy支持下,已经支持了简单的负载均衡.

引用链接

https://github.com/helm/charts/tree/master/stable/elasticsearch
https://www.cnblogs.com/zlslch/p/6420572.html

Guess you like

Origin www.cnblogs.com/gytangyao/p/11407223.html