apiVersion: apps/v1
kind: Deployment
metadata:
  name: elasticsearch
  namespace: elk
spec:
  replicas: 1
  selector:
    matchLabels:
      name: elasticsearch
  template:
    metadata:
      labels:
        name: elasticsearch
    spec:
      containers:
      - name: es
        image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9200
          name: http
          protocol: TCP
        - containerPort: 9300
          name: es
          protocol: TCP
        env:
        - name: ES_JAVA_OPTS
          value: -Xms1g -Xmx1g
        - name: discovery.type
          value: single-node
        volumeMounts:
        - mountPath: /usr/share/elasticsearch/data
          name: volume-data
      volumes:
        - hostPath:
            path: /data/es-data
            type: Directory
          name: volume-data
---
kind: Service
apiVersion: v1
metadata:
  name: elasticsearch
  namespace: elk
spec:
  ports:
  - name: es
    port: 9200
    targetPort: 9200
    protocol: TCP
  selector:
    name: elasticsearch

发表回复

您的电子邮箱地址不会被公开。

Captcha Code