当前位置:   article > 正文

k8s安装elasticsearch

k8s安装elasticsearch

镜像

镜像版本:可以去 https://hub.docker.com/ 搜索镜像,这里用的是elasticsearch:7.17.4
k8s已经存在存储类 (Storage Class):alicloud-disk-ssd

服务发现

apiVersion: v1
kind: Service
metadata:
  name: elasticsearch
spec:
  clusterIP: None
  ports:
  - name: elasticsearch-in
    port: 9300
    protocol: TCP
    targetPort: 9300
  - name: elasticsearch-out
    port: 9200
    protocol: TCP
    targetPort: 9200
  selector:
    app: elasticsearch
  type: ClusterIP
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

部署服务

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: elasticsearch
spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticsearch
  serviceName: elasticsearch
  template:
    metadata:
      labels:
        app: elasticsearch
    spec:
      containers:
      - env:
        - name: ES_JAVA_OPTS
          value: -Xms2048m -Xmx2048m
        - name: node.data
          value: "true"
        - name: node.master
          value: "true"
        - name:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/766741
推荐阅读
相关标签
  

闽ICP备14008679号