OKR/tob-upgrade/elastic/elastic.yaml

192 lines
4.3 KiB
YAML
Raw Normal View History

2023-11-03 16:05:54 +08:00
---
apiVersion: v1
kind: PersistentVolume
metadata:
2025-03-13 11:02:38 +08:00
name: elastic-training-0
2023-11-03 16:05:54 +08:00
spec:
2025-03-13 11:02:38 +08:00
storageClassName: elastic-training
2023-11-03 16:05:54 +08:00
capacity:
storage: 30Gi
accessModes:
- ReadWriteOnce
local:
2025-03-13 11:02:38 +08:00
path: /data/elastic-training/es_data
2023-11-03 16:05:54 +08:00
claimRef:
kind: PersistentVolumeClaim
2025-03-13 11:02:38 +08:00
namespace: training
name: elastic-training-elastic-0
2023-11-03 16:05:54 +08:00
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
2025-02-26 18:00:34 +08:00
- bfs-k8snode-10-2-3-8.hetzner.base.beaconfireinc.com
2023-11-03 16:05:54 +08:00
---
apiVersion: v1
kind: PersistentVolume
metadata:
2025-03-13 11:02:38 +08:00
name: elastic-training-1
2023-11-03 16:05:54 +08:00
spec:
2025-03-13 11:02:38 +08:00
storageClassName: elastic-training
2023-11-03 16:05:54 +08:00
capacity:
storage: 30Gi
accessModes:
- ReadWriteOnce
local:
2025-03-13 11:02:38 +08:00
path: /data/elastic-training/es_data
2023-11-03 16:05:54 +08:00
claimRef:
kind: PersistentVolumeClaim
namespace:
2025-03-13 11:02:38 +08:00
name: elastic-training-elastic-1
2023-11-03 16:05:54 +08:00
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
2025-02-26 18:00:34 +08:00
- bfs-k8snode-10-2-3-9.hetzner.base.beaconfireinc.com
2023-11-03 16:05:54 +08:00
---
apiVersion: v1
kind: PersistentVolume
metadata:
2025-03-13 11:02:38 +08:00
name: elastic-training-2
2023-11-03 16:05:54 +08:00
spec:
2025-03-13 11:02:38 +08:00
storageClassName: elastic-training
2023-11-03 16:05:54 +08:00
capacity:
storage: 30Gi
accessModes:
- ReadWriteOnce
local:
2025-03-13 11:02:38 +08:00
path: /data/elastic-training/es_data
2023-11-03 16:05:54 +08:00
claimRef:
kind: PersistentVolumeClaim
2025-03-13 11:02:38 +08:00
namespace: training
name: elastic-training-elastic-2
2023-11-03 16:05:54 +08:00
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
2025-02-26 18:00:34 +08:00
- bfs-k8snode-10-2-3-10.hetzner.base.beaconfireinc.com
2023-11-03 16:05:54 +08:00
2023-06-01 19:28:28 +08:00
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elastic
spec:
serviceName: elastic
replicas: 3
selector:
matchLabels:
app: elastic
template:
metadata:
labels:
app: elastic
spec:
securityContext:
fsGroup: 100
nodeSelector:
2025-02-26 18:09:20 +08:00
app.kubernetes.io/name: es
2023-06-01 19:28:28 +08:00
initContainers:
- name: init
image: busybox
imagePullPolicy: IfNotPresent
2023-11-03 16:05:54 +08:00
command: ["/bin/sh", "-c", "sysctl -w vm.max_map_count=262144;chown -R 1000:1000 /usr/share/elasticsearch/data"]
2023-06-01 19:28:28 +08:00
securityContext:
privileged: true
2023-11-03 16:05:54 +08:00
volumeMounts:
2025-03-13 11:02:38 +08:00
- name: elastic-training
2023-11-03 16:05:54 +08:00
mountPath: /usr/share/elasticsearch/data
2023-06-01 19:28:28 +08:00
containers:
- name: elasticsearch
2023-11-03 16:05:54 +08:00
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
imagePullPolicy: IfNotPresent
2023-06-01 19:28:28 +08:00
ports:
- containerPort: 9200
name: restful
- containerPort: 9300
name: transport
env:
- name: cluster.name
2025-03-13 11:02:38 +08:00
value: bfs-elastic-training-1
2023-06-01 19:28:28 +08:00
- name: network.host
value: 0.0.0.0
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: discovery.seed_hosts
value: "elastic-0.elastic,elastic-1.elastic,elastic-2.elastic"
- name: cluster.initial_master_nodes
value: "elastic-0,elastic-1,elastic-2"
- name: xpack.security.enabled
2023-11-03 16:05:54 +08:00
value: "false"
2023-06-01 19:28:28 +08:00
- name: xpack.monitoring.collection.enabled
2023-11-03 16:05:54 +08:00
value: "false"
2023-06-01 19:28:28 +08:00
- name: ES_JAVA_OPTS
2024-03-14 14:36:59 +08:00
value: "-Xms2048m -Xmx2048m"
2023-06-01 19:28:28 +08:00
- name: ELASTIC_PASSWORD
value: "changeme"
resources:
limits:
cpu: 2
2024-03-14 14:29:15 +08:00
memory: 8Gi
2023-06-01 19:28:28 +08:00
requests:
cpu: 100m
2024-03-14 14:29:15 +08:00
memory: 512Mi
2023-06-01 19:28:28 +08:00
volumeMounts:
2025-03-13 11:02:38 +08:00
- name: elastic-training
2023-06-01 19:28:28 +08:00
mountPath: /usr/share/elasticsearch/data
volumeClaimTemplates:
- metadata:
2025-03-13 11:02:38 +08:00
name: elastic-training
2023-06-01 19:28:28 +08:00
spec:
accessModes: ['ReadWriteOnce']
2025-03-13 11:02:38 +08:00
storageClassName: "elastic-training"
2023-06-01 19:28:28 +08:00
resources:
requests:
storage: 30Gi
---
apiVersion: v1
kind: Service
metadata:
name: elastic-internel
labels:
app: elastic
spec:
ports:
- name: restful
port: 9200
targetPort: 9200
2024-03-14 14:29:15 +08:00
type: ClusterIP
2023-06-01 19:28:28 +08:00
selector:
2023-11-03 16:05:54 +08:00
app: elastic
2023-06-01 19:28:28 +08:00
---
apiVersion: v1
kind: Service
metadata:
2023-11-03 16:05:54 +08:00
name: elastic
2023-06-01 19:28:28 +08:00
labels:
app: elastic
spec:
ports:
- name: restful
port: 9200
- name: transport
port: 9300
clusterIP: None
selector:
app: elastic
2023-11-03 16:05:54 +08:00