apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch-node1
namespace: branch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
initContainers:
- name: fix-permissions
image: busybox
command: ['sh', '-c', 'chown -R 1000:1000 /usr/share/elasticsearch/config']
volumeMounts:
- name: config-volume
mountPath: /usr/share/elasticsearch/config
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:8.13.2
securityContext:
runAsUser: 1000
runAsGroup: 1000
env:
- name: discovery.type
value: single-node
volumeMounts:
- name: config-volume
mountPath: /usr/share/elasticsearch/config
volumes:
- name: config-volume
hostPath:
path: /data/containerd/elasticsearch/node1
type: Directory
nodeSelector:
name: node2