﻿---
title: Add custom configuration files with ConfigMaps or Secrets
description: Mount custom configuration files into Elasticsearch pods on ECK with ConfigMaps or Secrets.
url: https://www.elastic.co/elastic/docs-builder/docs/4302/deploy-manage/plugins-and-custom-configuration-files/cloud-on-k8s/custom-configuration-files-plugins
products:
  - Elastic Cloud on Kubernetes
  - Elastic Documentation
applies_to:
  - Elastic Cloud on Kubernetes: Generally available
---

# Add custom configuration files with ConfigMaps or Secrets
On Elastic Cloud on Kubernetes, custom configuration files such as synonym dictionaries, SAML metadata, or CA certificates are stored in a ConfigMap or Secret, then mounted into your Elasticsearch pods with volumes and volume mounts.
This page walks through a synonyms file for the [synonym token filter](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4302/reference/text-analysis/analysis-synonym-tokenfilter). You can use the same pattern for any other file you want to mount into the configuration directory of Elasticsearch, like adding CA certificates of external systems for example.
<note>
  ConfigMaps and Secrets are for custom configuration files only. They do not install plugins. To install plugins, use a [custom image](https://www.elastic.co/elastic/docs-builder/docs/4302/deploy-manage/deploy/cloud-on-k8s/create-custom-images) or [init containers](https://www.elastic.co/elastic/docs-builder/docs/4302/deploy-manage/plugins-and-custom-configuration-files/cloud-on-k8s/init-containers-for-plugin-downloads).
</note>


## Create the ConfigMap or Secret

There are multiple ways to create and mount [ConfigMaps](https://kubernetes.io/docs/concepts/configuration/configmap/) and [Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) on Kubernetes. Refer to the Kubernetes documentation for details.
This example creates a ConfigMap named `synonyms` from a local file `my-synonyms.txt`, stored under the key `synonyms-elasticsearch.txt`:
```sh
kubectl create configmap synonyms -n <namespace> --from-file=synonyms-elasticsearch.txt=my-synonyms.txt
```

<tip>
  Create the ConfigMap or Secret in the same namespace where your Elasticsearch cluster runs.
</tip>


## Mount the ConfigMap in the Elasticsearch pods

Update your Elasticsearch manifest to mount the `synonyms` ConfigMap at `/usr/share/elasticsearch/config/dictionaries`:
```yaml
spec:
  nodeSets:
  - name: default
    count: 3
    podTemplate:
      spec:
        containers:
        - name: elasticsearch 
          volumeMounts:
          - name: synonyms
            mountPath: /usr/share/elasticsearch/config/dictionaries 
        volumes:
        - name: synonyms
          configMap: 
            name: synonyms 
```

After you apply the changes, the nodes can read `dictionaries/synonyms-elasticsearch.txt` and reference it from any [configuration setting](https://www.elastic.co/elastic/docs-builder/docs/4302/deploy-manage/deploy/cloud-on-k8s/node-configuration).