当前位置:   article > 正文

k8s部署ElasticSearch

k8s部署ElasticSearch

k8s部署ElasticSearch

apiVersion: v1
kind: ConfigMap
metadata:
  name: es-7
  namespace: pie-engine-infra
data:
  elasticsearch.yml: |
    node.name: master
    cluster.initial_master_nodes: ["master"]
    network.host: 0.0.0.0
    path.data: /data
    http.cors.enabled: true
    http.cors.allow-origin: "*"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch7-single
  namespace: pie-engine-infra
spec:
  replicas: 1
  selector:
    matchLabels:
      name: elasticsearch7
  template:
    metadata:
      labels:
        name: elasticsearch7
    spec:
      initContainers:
      - name: init-sysctl
        image: busybox:stable
        imagePullPolicy: IfNotPresent
        command:
        - sysctl
        - -w
        - vm.max_map_count=655360
        securityContext:
          privileged: true
      containers:
      - name: elasticsearch
        image: infra/elasticsearch:7.5.2
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9200
        - containerPort: 9300
        volumeMounts:
        - name: es-data
          mountPath: /data
        - name: es-plugins
          mountPath: /usr/share/elasticsearch/plugins
        - name: es-conf
          mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
          subPath: elasticsearch.yml
      volumes:
      - name: es-data
        hostPath:
          path: /data/resource/middleware/es7/data
      - name: es-plugins
        hostPath:
          path: /home/software/elasticsearch/k8s-es/plugins
      - name: es-conf
        configMap:
            name: es-7
---
apiVersion: v1
kind: Service
metadata:
  name: elasticsearch7-single
  namespace: pie-engine-infra
  labels:
    name: elasticsearch7
spec:
  type: NodePort
  ports:
  - port: 9200
    targetPort: 9200
    nodePort: 30920
    name: elasticsearch7-single1
  - port: 9300
    targetPort: 9300
    nodePort: 30930
    name: elasticsearch7-single2
  selector:
    name: elasticsearch7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

注意:数据挂载的目录要给权限 chomd 777 挂载目录

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/524446
推荐阅读
相关标签
  

闽ICP备14008679号