Cannot mount elasticsearch.yml in ECK CRD

I am trying to mount elasticsearch.yml from my kubernetes configmap as follows but the elastic-internal-init-filesystem init container is throwing error.
Error

Starting init script
Linking /mnt/elastic-internal/xpack-file-realm/users to /usr/share/elasticsearch/config/users
Linking /mnt/elastic-internal/xpack-file-realm/roles.yml to /usr/share/elasticsearch/config/roles.yml
Linking /mnt/elastic-internal/xpack-file-realm/users_roles to /usr/share/elasticsearch/config/users_roles
Linking /mnt/elastic-internal/elasticsearch-config/elasticsearch.yml to /usr/share/elasticsearch/config/elasticsearch.yml
ln: cannot remove '/usr/share/elasticsearch/config/elasticsearch.yml': Device or resource busy

Elasticsearch YAML

- name: masters-zone-a
  count: 3
  config:
    node.master: true
    node.data: false
    node.ingest: false
  podTemplate:
    spec:
      initContainers:
      - name: sysctl
        securityContext:
          privileged: true
        command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
      containers:
      - name: elasticsearch
        env:
        #- name: PRE_STOP_MAX_WAIT_SECONDS
        #  value: "10"
        #- name: PRE_STOP_ADDITIONAL_WAIT_SECONDS
        #  value: "5"
        - name: ES_JAVA_OPTS
          value: '-Djava.net.preferIPv4Stack=true -Xms512m -Xmx512m  '
        - name: MINIMUM_MASTER_NODES
          value: "2"
        resources:
          requests:
            cpu: 200m
            memory: 3Gi
          limits:
            cpu: 500m
            memory: 3Gi
        volumeMounts:
        - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
          name: config
          subPath: elasticsearch.yml
        - mountPath: /usr/share/elasticsearch/config/jvm.options
          name: config
          subPath: jvm.options
        - mountPath: /usr/share/elasticsearch/config/log4j2.properties
          name: config
          subPath: log4j2.properties
      volumes:
      - configMap:
          name: elasticsearch-config
        name: config
      

It seems that internally elasticsearch.yml is getting mounted. How can I update the yml since it is a big file.

Hi Aman,

I also replied to you Slack DM.

You shouldn't mount elasticsearch.yml when using ECK.

You are supposed to make these changes in the deployment as following:
https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-node-configuration.html

Hope it makes sense

Thanks

Thanks @nitzang1