Official elasticsearch helm chart - Unable to install plugins

Hello,

I'm using the official elasticsearch helm chart (elasticsearch 7.13.1 · elastic/elastic) and I'm trying to use "extraInitContainers" to install the "repository-azure" plugin. I do know that the recommended way to install plugins is to create a custom docker image, but I would rather use an init container.

Here are my helm commands:

helm repo add elastic https://helm.elastic.co
helm -n efk -f values.yaml install elasticsearch elastic/elasticsearch

Here is my values.yaml file:

extraInitContainers:
  - name: install-plugins
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.1
    imagePullPolicy: IfNotPresent
    command:
    - sh
    - -c
    - |
      bin/elasticsearch-plugin install --batch repository-azure

The pods come up fine:

NAME                             READY   STATUS    RESTARTS   AGE
elasticsearch-master-0           1/1     Running   0          16m
elasticsearch-master-1           1/1     Running   0          16m
elasticsearch-master-2           1/1     Running   0          16m

But the plugin does not get installed:

curl -s -X GET http://central-logging-es.cbreesi.com/_nodes?filter_path=nodes.*.plugins | jq .
{
  "nodes": {
    "sSyIwbzXSDy39IFstwE30Q": {
      "plugins": []
    },
    "MDI79D9AQl21visj2dZ03A": {
      "plugins": []
    },
    "0T-DaBSbTxiznEmawbpgTw": {
      "plugins": []
    }
  }
}

More verification that the plugin was not installed:

$ kubectl -n efk exec --stdin --tty elasticsearch-master-0 -- /bin/sh
Defaulted container "elasticsearch" out of: elasticsearch, configure-sysctl (init), install-plugins (init)
sh-4.4$ bin/elasticsearch-plugin list
sh-4.4$
sh-4.4$ ls plugins
sh-4.4$

What am I doing wrong?

Thanks

SOLVED
None of the documentation I found mentioned that you need a volume mount for this to work. So I experimented and got the plugin installed with the following values.yaml:

# init container to install the azure repository plugin for backup snapshots
extraInitContainers:
  - name: install-plugins
    image: docker.elastic.co/elasticsearch/elasticsearch:7.13.1
    imagePullPolicy: IfNotPresent
    command:
    - sh
    - -c
    - |
      bin/elasticsearch-plugin install --batch repository-azure
    volumeMounts:
    - name: plugins
      mountPath: /usr/share/elasticsearch/plugins

# Volume mount to store the repository-azure plugin
extraVolumes:
  - name: plugins
    emptyDir: {}
extraVolumeMounts:
  - name: plugins
    mountPath: /usr/share/elasticsearch/plugins
    readOnly: false