You can achieve this by writing the installation script in the args section of deployment.yml.
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: torico
name: elasticsearch
spec:
selector:
matchLabels:
app: elasticsearch
strategy:
type: Recreate
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
name: elasticsearch
env:
- name: discovery.type
value: single-node
- name: cluster.name
value: docker-cluster
- name: bootstrap.memory_lock
value: "true"
- name: ES_JAVA_OPTS
value: "-Xms512m -Xmx512m"
ports:
- containerPort: 9200
name: elasticsearch
volumeMounts:
- name: elasticsearch-data
mountPath: /usr/share/elasticsearch/data
command:
- /bin/sh
- -c
args:
# Install analysis-icu and then start ES
- "bin/elasticsearch-plugin install analysis-icu && /tini -s -- /usr/local/bin/docker-entrypoint.sh eswrapper"
# For docker image settings
# Check with docker inspect docker.elastic.co/elasticsearch/elasticsearch:7.8.0
# Entrypoint: /tini -- /usr/local/bin/docker-entrypoint.sh
# Cmd: eswrapper
- image: docker.elastic.co/kibana/kibana:7.8.0
name: kibana
ports:
- containerPort: 5601
name: kibana
volumes:
- name: elasticsearch-data
hostPath:
path: /data/elasticsearch
Comments