RousselTMLEARNING

Observability

Elasticsearch on Kubernetes with ECK: deployment, persistent storage and upgrades

Deploy Elasticsearch and Kibana on Kubernetes with Elastic Cloud on Kubernetes (ECK): operator, Elasticsearch and Kibana resources, nodeSets, persistent storage, automatic security, upgrades and best practices.

1. Installing the operator #

CRDs and operator.

Installation #

ECK architecture
kubectl create -f https://download.elastic.co/downloads/eck/2.16.1/crds.yaml
kubectl apply  -f https://download.elastic.co/downloads/eck/2.16.1/operator.yaml
kubectl -n elastic-system logs statefulset/elastic-operator
Good to know: Replace the ECK version with the latest published one; it determines the supported Stack versions.

2. Declaring a cluster #

nodeSets and volumes.

Manifest #

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata: { name: logs }
spec:
  version: 8.17.0
  nodeSets:
    - name: master
      count: 3
      config: { node.roles: [ master ] }
      volumeClaimTemplates:
        - metadata: { name: elasticsearch-data }
          spec: { accessModes: [ ReadWriteOnce ], resources: { requests: { storage: 10Gi } } }
    - name: hot
      count: 3
      config: { node.roles: [ data_hot, data_content, ingest ] }
      podTemplate:
        spec:
          containers:
            - name: elasticsearch
              resources: { requests: { memory: 8Gi, cpu: 2 }, limits: { memory: 8Gi } }
      volumeClaimTemplates:
        - metadata: { name: elasticsearch-data }
          spec: { accessModes: [ ReadWriteOnce ], storageClassName: fast-ssd, resources: { requests: { storage: 500Gi } } }
---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata: { name: logs }
spec: { version: 8.17.0, count: 1, elasticsearchRef: { name: logs } }
kubectl get elasticsearch
kubectl get secret logs-es-elastic-user -o go-template='{{.data.elastic | base64decode}}' 

3. Operating #

Upgrades and pitfalls.

Practices #

  • Upgrade: change spec.version; ECK restarts pods one by one while respecting cluster health.
  • Resize a nodeSet: change count; ECK migrates data before deleting a pod.
  • TLS and the elastic user are generated automatically; custom certificates are possible.
  • Per-node anti-affinity and spreading across zones (topologySpreadConstraints) for high availability.
Common mistake: A StorageClass with reclaimPolicy: Delete destroys data when the cluster is deleted. For production, use Retain and snapshots.

Related articles

Transforms and enrich: summarising and enriching data in Elasticsearch

Build entity-centric indices with pivot and latest transforms, and enrich documents at ingest time with enric…

OpenTelemetry and Elasticsearch: compatibility and architecture

Send OpenTelemetry to Elasticsearch: Collector and elasticsearch exporter, managed OTLP endpoint, APM Server,…

Ingesting OpenTelemetry logs into Elasticsearch

Collect and structure logs with the OpenTelemetry Collector (filelog receiver, operators, transform processor…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!