上传文件至 es-yaml

This commit is contained in:
tu 2024-06-07 15:23:35 +08:00
parent 5beca58ec1
commit 671e11abd1
5 changed files with 125 additions and 0 deletions

View File

@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: es
namespace: logging
spec:
serviceName: elasticsearch
replicas: 3
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
nodeSelector:
es: log
initContainers:
- name: increase-vm-max-map
image: busybox
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
- name: increase-fd-ulimit
image: busybox
command: ["sh", "-c", "ulimit -n 65536"]
securityContext:
privileged: true
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
ports:
- name: rest
containerPort: 9200
- name: inter
containerPort: 9300
resources:
limits:
cpu: 1000m
requests:
cpu: 1000m
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
env:
- name: cluster.name
value: k8s-logs
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: cluster.initial_master_nodes
value: "es-0,es-1,es-2"
- 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"
volumes:
- name: data
persistentVolumeClaim:
claimName: es-data-db
# volumeClaimTemplates:
# - metadata:
# name: data
# labels:
# app: elasticsearch
# spec:
# accessModes: [ "ReadWriteOnce" ]
# storageClassName: es-data-db
# resources:
# requests:
# storage: 20Gi

View File

@ -0,0 +1,18 @@
kind: Service
apiVersion: v1
metadata:
name: elasticsearch
namespace: logging
labels:
app: elasticsearch
spec:
selector:
app: elasticsearch
type: NodePort
ports:
- port: 9200
targetPort: 9200
nodePort: 30010
name: rest
- port: 9300
name: inter-node

13
es-yaml/es-pv.yaml Normal file
View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: es-pv
namespace: logging
spec:
capacity:
storage: 2000Mi
accessModes:
- ReadWriteMany
nfs:
server: 10.1.0.54
path: /data/es

11
es-yaml/es-pvc.yaml Normal file
View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: es-data-db
namespace: logging
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2000Mi

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: logging