You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deploy-manage/deploy/cloud-on-k8s/custom-configuration-files-plugins.md
+69-27Lines changed: 69 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ mapped_pages:
7
7
8
8
# Custom configuration files and plugins [k8s-bundles-plugins]
9
9
10
-
To run Elasticsearch with specific plugins or configuration files installed on ECK, you have two options. Each option has its own pros and cons.
10
+
To run Elasticsearch with specific plugins or configuration files installed on ECK, you have multiple options. Each option has its own pros and cons.
11
11
12
12
1. Create a custom container image with the required plugins and configuration files.
13
13
@@ -35,9 +35,26 @@ To run Elasticsearch with specific plugins or configuration files installed on E
35
35
* Each Elasticsearch node needs to repeat the download, wasting bandwidth and slowing startup.
36
36
* Deployment manifests are more complicated.
37
37
38
+
3. Use ConfigMaps or Secrets together with volumes and volume mounts for configuration files.
39
+
40
+
***Pros**
41
+
42
+
* Best choice for injecting configuration files into your {{es}} nodes.
43
+
* Follows standard Kubernetes methodology to mount files into Pods.
44
+
45
+
***Cons**
46
+
47
+
* Not valid for plugins installation.
48
+
* Requires to maintain the ConfigMaps or Secrets with the content of the files.
49
+
50
+
The following sections provide examples for each of the mentioned options.
51
+
52
+
## Create a custom image
38
53
39
54
Refer to [Creating custom images](create-custom-images.md) for instructions on how to build custom Docker images based on the official Elastic images.
40
55
56
+
## Use init containers for plugins installation
57
+
41
58
The following example describes option 2, using a repository plugin. To install the plugin before the Elasticsearch nodes start, use an init container to run the [plugin installation tool](https://www.elastic.co/guide/en/elasticsearch/plugins/current/installation.html).
To install custom configuration files you can use volumes and volume mounts.
77
+
### Note when using Istio [istio-note]
61
78
62
-
The next example shows how to add a synonyms file for the [synonym token filter](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-tokenfilter.html) in Elasticsearch. But you can use the same approach for any kind of file you want to mount into the configuration directory of Elasticsearch.
79
+
When using Istio, init containers do **not** have network access, as the Envoy sidecar that provides network connectivity is not started yet. In this scenario, custom containers are the best option. If custom containers are simply not a viable option, then it is possible to adjust the startup command for the elasticsearch container itself to run the plugin installation before starting Elasticsearch, as the following example describes. Note that this approach will require updating the startup command if it changes in the Elasticsearch image, which could potentially cause failures during upgrades.
1. Elasticsearch runs by convention in a container called *elasticsearch*.
83
-
2. Assuming you have created a config map in the same namespace as Elasticsearch with the name *synonyms* containing the synonyms file(s).
102
+
## Use a volume and volume mount together with a ConfigMap or Secret
84
103
104
+
To install custom configuration files you can:
85
105
86
-
$$$istio-note$$$
87
-
**Note when using Istio**
106
+
1. Add the configuration data into a ConfigMap or Secret.
107
+
2. Use volumes and volume mounts in your manifest to mount the contents of the ConfigMap or Secret as files in your {{es}} nodes.
88
108
89
-
When using Istio, init containers do **not** have network access, as the Envoy sidecar that provides network connectivity is not started yet. In this scenario, custom containers are the best option. If custom containers are simply not a viable option, then it is possible to adjust the startup command for the elasticsearch container itself to run the plugin installation before starting Elasticsearch, as the following example describes. Note that this approach will require updating the startup command if it changes in the Elasticsearch image, which could potentially cause failures during upgrades.
109
+
The next example shows how to add a synonyms file for the [synonym token filter](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-tokenfilter.html) in Elasticsearch. But you can **use the same approach for any kind of file you want to mount into the configuration directory of Elasticsearch**, like adding CA certificates of external systems.
110
+
111
+
1. Create the ConfigMap or Secret with the data:
112
+
113
+
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 official documentation for more details.
114
+
115
+
This example shows how to create a ConfigMap named `synonyms` with the content of a local file named `my-synonyms.txt` added into the `synonyms-elasticsearch.txt` key of the ConfigMap.
Create the ConfigMap or Secret in the same namespace where your {{es}} cluster runs.
123
+
::::
124
+
125
+
2. Declare the ConfigMap as a volume and mount it in the Elasticsearch containers.
126
+
127
+
In this example, modify your {{es}} manifest to mount the contents of the `synonyms` ConfigMap into `/usr/share/elasticsearch/config/dictionaries` on the {{es}} nodes.
1. Elasticsearch runs by convention in a container called `elasticsearch`. Do not change that value.
148
+
2. Use always a path under `/usr/share/elasticsearch/config`.
149
+
3. Use `secret` instead of `configMap` if you used a secret to store the data.
150
+
4. The ConfigMap name must be the same as the ConfigMap created in the previous step.
151
+
152
+
After the changes are applied, {{es}} nodes should be able to access `dictionaries/synonyms-elasticsearch.txt` and use it in any [configuration setting](./node-configuration.md).
0 commit comments