Hi,
I'm using ECK to create elasticsearch + logstash.
To being able to setup my index lifecycle policy, I need to run an initContainer on my logstash pod.
Inside my logstash pod I have access to the env environment variable create by elasticsearchRefs (like xxxxxxxxx_ES_HOSTS, xxxxxxxxxxx_ES_USER, etc....).
But nothing inside the initContainer.
There is a way to enable that ?
Here my configuration:
apiVersion: logstash.k8s.elastic.co/v1alpha1
kind: Logstash
metadata:
name: logstash
namespace: test
spec:
config:
log.level: info
pipeline.workers: 1
count: 1
elasticsearchRefs:
- clusterName: elasticsearch-test
name: elasticsearch-test
pipelinesRef:
secretName: logstash-pipelines-config
podTemplate:
spec:
containers:
- env:
- name: PIPELINE_WORKERS
value: "1"
- name: LOGSTASH_JDBC_INPUT_SERVER
valueFrom:
configMapKeyRef:
key: DbConnectionStringDataSource
name: website-config
- name: LOGSTASH_JDBC_INPUT_DATABASE
valueFrom:
configMapKeyRef:
key: DbConnectionStringInitialCatalog
name: website-config
- name: LOGSTASH_JDBC_INPUT_USER
value: sa
- name: LOGSTASH_JDBC_INPUT_PASSWORD
valueFrom:
secretKeyRef:
key: sa-password
name: sqlserver-account
- name: MONITORING_ENABLED
value: "false"
name: logstash
volumeMounts:
- mountPath: /usr/share/logstash/sql
name: logstash-sql-volume
- mountPath: /usr/share/logstash/pipeline
name: logstash-pipeline-volume
- mountPath: /usr/share/logstash/jars
name: jars-volume
initContainers:
- args:
- -c
- curl https://download.microsoft.com/download/4/D/C/4DCD85FA-0041-4D2E-8DD9-833C1873978C/sqljdbc_7.2.2.0_enu.tar.gz
--output sqljdbc_7.2.2.0_enu.tar.gz && tar xzf sqljdbc_7.2.2.0_enu.tar.gz
&& mv sqljdbc_7.2/enu/mssql-jdbc-7.2.2.jre8.jar /data/mssql-jdbc.jar
command:
- /bin/sh
name: download-jdbc-sqlserver
volumeMounts:
- mountPath: /data
name: jars-volume
- args:
- -c
- bash /data/scripts/entrypoint.sh
command:
- /bin/sh
name: apply-index-template-iml
volumeMounts:
- mountPath: /data/ilm
name: logstash-index-lifecycle-policy-volume
- mountPath: /data/indexTemplate
name: logstash-index-template-volume
- mountPath: /data/scripts
name: logstash-scripts-volume
nodeSelector:
kubernetes.io/os: linux
volumes:
- name: logstash-sql-volume
secret:
secretName: logstash-sql
- name: logstash-pipeline-volume
secret:
secretName: logstash-pipeline
- name: logstash-index-lifecycle-policy-volume
secret:
secretName: logstash-index-lifecycle-policy
- name: logstash-index-template-volume
secret:
secretName: logstash-index-template
- name: logstash-scripts-volume
secret:
secretName: logstash-scripts
version: 8.13.1
volumeClaimTemplates:
- metadata:
name: logstash-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: no-replica
- metadata:
name: jars-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
storageClassName: no-replica
Thanks in advance for your help