如何在 Kubernetes 集群上部署 Elasticsearch?
如何在 Kubernetes 集群上部署 Elasticsearch?我需要在集群外部使用 Elasticsearch。为此,我应该使用哪种服务?谁能发布部署和服务 yaml 文件吗?
How can I deploy Elasticsearch on Kubernetes cluster? I need to use the Elasticsearch outside to my cluster. For that, which service that I should use? Can anyone post the deployment and service yaml files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您想在生产中运行elasticsearch,您可以使用helm图表来部署elasticsearch。
Helm 图表:https://github.com/elastic/helm-charts
如果您只是您可以在 YAML 文件下面进行部署以进行开发和测试:
参考要点:https://gist.github.com/harsh4870/ccd6ef71eaac2f09d7e136307e3ecda6
您可以使用 LoadBalancer 类型公开 Elasticsearch 服务,并将其公开到互联网并使用它。
service.yaml
注意:
您需要使用NodePort或LoadBalancer作为ClusterIp<的服务类型/strong> 除非您使用某些代理设置或入口,否则您将无法公开服务。
You can use the helm chart to deploy the elasticsearch if you want to run it in production.
Helm chart : https://github.com/elastic/helm-charts
If you are just deploying for development and testing you can below YAML file :
Ref Gist : https://gist.github.com/harsh4870/ccd6ef71eaac2f09d7e136307e3ecda6
You can expose the Elasticsearch service with type LoadBalancer and expose it to internet and use it.
service.yaml
Note :
you need to use the NodePort or LoadBalancer as service type with ClusterIp you wont be able to expose service unless you use some proxy setup or ingress.
正如其他答案所指出的,您可以使用 helm 图表,但是 Elastic 也发布了其 自己的操作符,这是一个比部署裸 StatefulSet 更强大的选项
要安装操作符:
并部署集群
如果您想准备好此生产,您可能需要做一些进一步的调整您都可以在文档中找到
As other answers have pointed out, you can use helm charts, however Elastic has also published its own operator which is a significantly more robust option than deploying a bare statefulSet
To install the operator:
And to deploy a cluster
If you want to have this production ready, you probably want to make some further adjustments that you can all find in the documentation
好吧,以下 yaml 对我有用
elasticsearch-deploy.yaml:
现在,我们想要从集群外部访问这个elastic-search。默认情况下,部署将分配 clusterip 服务,用于访问同一集群内的 pod。这里我们使用 NodePort 服务来访问集群外部。
elasticsearch-service.yaml:
这使您的服务可以通过浏览器访问:
例如:
HTTP://192.168.18.90:31200/
输出如下:
well, the following yamls works for me
elasticsearch-deploy.yaml:
Now, we wants to access this elastic-search from outside our cluster.By default deployments will assign clusterip service which is used to access the pods inside the same cluster.Here we use NodePort service to access outside our cluster.
elasticsearch-service.yaml:
this makes your service to access from your browser by:
eg:
HTTP://192.168.18.90:31200/
output be like:
您可以尝试使用 YAML 文件,如下所示:
要使用外部的elasticsearch进行集群,请尝试以下操作:
You can try using YAML file as belwo:
To use the elasticsearch out-side to cluster, try this:
这个清单 (deployment.yaml) 在 GCP Kubernetes Engine 中适用于我,
您使用以下命令运行:
并使用此服务,您可以检查外部 IP (http://serviceIP:9200),运行相同的命令:
this manifest (deployment.yaml) works for me in GCP Kubernetes Engine,
you run the with the command:
and with this service you can check with a external IP (http://serviceIP:9200), run the same: