elasticsearch-config.yaml


Overview

elasticsearch-config.yaml is a Kubernetes ConfigMap manifest template designed to configure an Elasticsearch node within a deployment. It dynamically generates configuration data based on Helm chart values, specifically when the document engine (DOC_ENGINE) is set to "elasticsearch". This file provides key Elasticsearch settings such as node identity, cluster discovery mode, security features, disk allocation watermarks, and timezone configuration. The resulting ConfigMap is used by the Elasticsearch pod(s) to initialize and run with the specified parameters.


Detailed Explanation

Template Conditions


Kubernetes Resource Definition


ConfigMap Data Entries

Key

Description

Type

Example Value

node.name

The name of the Elasticsearch node. Used internally by Elasticsearch cluster nodes.

string

"es01"

bootstrap.memory_lock

Whether to lock the memory on startup to prevent swapping. "false" disables memory locking.

string (bool)

"false"

discovery.type

The type of discovery used by Elasticsearch. "single-node" is for single-node clusters.

string

"single-node"

xpack.security.enabled

Enables or disables X-Pack security features. Here it is enabled ("true").

string (bool)

"true"

xpack.security.http.ssl.enabled

Enables or disables SSL/TLS for HTTP communication. Disabled here ("false").

string (bool)

"false"

xpack.security.transport.ssl.enabled

Enables or disables SSL/TLS for transport (node-to-node) communication. Disabled here ("false").

string (bool)

"false"

cluster.routing.allocation.disk.watermark.low

Low disk watermark threshold for shard allocation. Accepts sizes like 5gb.

string

5gb

cluster.routing.allocation.disk.watermark.high

High disk watermark threshold to relocate shards away.

string

3gb

cluster.routing.allocation.disk.watermark.flood_stage

Flood stage disk watermark to mark the index read-only to prevent data loss.

string

2gb

TZ

Timezone setting, dynamically set from Helm values .Values.env.TIMEZONE.

string

e.g., "UTC" or "America/New_York"


Usage Example

In a Helm deployment scenario, this file is rendered only if the environment variable DOC_ENGINE is set to "elasticsearch". For example, in your values.yaml:

env:
  DOC_ENGINE: elasticsearch
  TIMEZONE: UTC

When Helm renders this template, it produces a ConfigMap named something like myapp-es-config with the specified Elasticsearch configuration. This ConfigMap can then be mounted as a volume in an Elasticsearch pod and used to configure the Elasticsearch instance on startup.


Implementation Details & Algorithms


Interaction with Other System Components


Visual Diagram

flowchart TD
    A[Helm Template Render] --> B{Check DOC_ENGINE}
    B -- yes: elasticsearch --> C[Render elasticsearch-config.yaml]
    B -- no --> D[Skip elasticsearch-config.yaml]

    C --> E[Create Kubernetes ConfigMap]
    E --> F[ConfigMap with Elasticsearch Settings]
    F --> G[Mounted into Elasticsearch Pod]

    G --> H[Elasticsearch Node Startup]
    H --> I[Elasticsearch configured with:]
    I -->|node.name| J["es01"]
    I -->|discovery.type| K["single-node"]
    I -->|xpack.security.enabled| L["true"]
    I -->|Disk Watermarks| M["Low=5gb, High=3gb, Flood=2gb"]
    I -->|Timezone| N[Set to .Values.env.TIMEZONE]

Summary

This file serves as a conditional Kubernetes ConfigMap template that configures Elasticsearch nodes with essential runtime parameters when Elasticsearch is used as the document engine. It enables basic security, sets discovery mode to single-node, configures disk watermarks, and applies timezone settings, providing a foundational Elasticsearch configuration for the application environment.


End of Documentation for elasticsearch-config.yaml