From f9a56832bd0b4aaa6cb82f3dd59790fdd5361f46 Mon Sep 17 00:00:00 2001 From: diandian Date: Thu, 29 Aug 2024 15:09:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es.yaml | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 es.yaml diff --git a/es.yaml b/es.yaml new file mode 100644 index 0000000..52a13ae --- /dev/null +++ b/es.yaml @@ -0,0 +1,143 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + k8s.kuboard.cn/name: es + app: elastcisearch + name: es + namespace: logging +spec: + replicas: 2 + selector: + matchLabels: + app: elasticsearch + serviceName: elasticsearch + template: + metadata: + labels: + app: elasticsearch + spec: + containers: + - env: + - name: cluster.name + value: k8s-logs + - name: node.name + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: cluster.initial_master_nodes + value: 'es-0,es-1' + - name: discovery.zen.minimum_master_nodes + value: '2' + - name: discovery.seed_hosts + value: elasticsearch + - name: ESJAVAOPTS + value: '-Xms512m -Xmx512m' + - name: network.host + value: 0.0.0.0 + - name: node.max_local_storage_nodes + value: '3' + - name: TZ + value: Asia/Shanghai + image: '10.9.12.201/xingdian/es:7.6.2' + imagePullPolicy: IfNotPresent + name: elasticsearch + ports: + - containerPort: 9200 + name: rest + protocol: TCP + - containerPort: 9300 + name: inter + protocol: TCP + resources: + limits: + cpu: 500m + memory: 1000Mi + requests: + cpu: 500m + memory: 1000Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /usr/share/elasticsearch/data + name: data + initContainers: + - command: + - sysctl + - '-w' + - vm.max_map_count=262144 + image: 10.9.12.201/xingdian/busybox + imagePullPolicy: IfNotPresent + name: increase-vm-max-map + resources: {} + securityContext: + privileged: true + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + - command: + - sh + - '-c' + - ulimit -n 65536 + image: 10.9.12.201/xingdian/busybox + imagePullPolicy: IfNotPresent + name: increase-fd-ulimit + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + nodeSelector: + es: log + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate + volumeClaimTemplates: + - apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + creationTimestamp: null + labels: + app: elasticsearch + name: data + spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 10Gi + storageClassName: es + volumeMode: Filesystem + +--- +apiVersion: v1 +kind: Service +metadata: + annotations: {} + labels: + app: elasticsearch + name: elasticsearch + namespace: logging +spec: + internalTrafficPolicy: Cluster + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - name: rest + port: 9200 + protocol: TCP + targetPort: 9200 + - name: inter-node + port: 9300 + protocol: TCP + targetPort: 9300 + selector: + app: elasticsearch + sessionAffinity: None + type: ClusterIP + +