cluster-eck

by startxfr

Helm chartv21.3.412App 3.5.0GPL-3.0-or-laterVerified publisher

Configure the Elastic Cloud on Kubernetes (ECK) operator and the Elasticsearch clusters and Kibana instances it manages

About this chart

Cluster Chart : Elasticsearch

Configure the Elastic Cloud on Kubernetes (ECK) operator and the Elasticsearch clusters and Kibana instances it manages.

This chart is part of the cluster-xxx startx helm chart series that doesn't necessarily deploy pods but rather represent a cluster configuration state orchestrated by gitops tools like ArgoCD.

This chart installs the certified elasticsearch-eck-operator-certified operator of Elastic and manages:

  • the Elasticsearch clusters (Elasticsearch CR): version, node sets, configuration, resources and volumes, with an optional route
  • the Kibana instances (Kibana CR) connected to these clusters, with an optional route
  • the kernel setting required by Elasticsearch on the nodes (Tuned CR of the Node Tuning Operator)
  • the secrets referenced by these resources (secure settings, users, certificates), from values or through an ExternalSecret

The other resources of the operator (Elastic Agent, Beats, Logstash, APM Server...) are not managed by this chart.

Requirements and guidelines

Read the startx helm-repository homepage for more information on how to use these resources.

Prerequisites

  • Access to the certified-operators catalog of the software catalog
  • cluster-admin privileges
  • A storage class for the data volumes of Elasticsearch (the default one unless storageClassName is set)
  • The Elastic resources must be created in a regular namespace: never default, kube-* or openshift-*, where the security context constraints are not applied as Elasticsearch expects
  • The namespace must be attached to the default pod network. The operator manages Elasticsearch and Kibana through their HTTP services: a namespace attached to a primary user-defined network isolates them from the operator

The operator is installed in the openshift-operators namespace (AllNamespaces mode), so no dedicated OperatorGroup is created. The Elasticsearch clusters and the Kibana instances run in the default-eck namespace created by the project sub-chart, with the restricted-v2 security context constraint of OpenShift: no privileged init container is used, and the Elasticsearch plugins cannot be installed at runtime (build a custom image instead).

Virtual memory of the nodes

Elasticsearch maps its indices in memory and needs a high vm.max_map_count kernel setting on the nodes it runs on:

  • OpenShift nodes set vm.max_map_count to 262144 with their default tuning profile
  • Elastic recommends 1048576 in production for Elasticsearch 8.16 and later

The tuned block creates a Tuned resource raising this setting on the selected nodes, without reboot. Select the nodes running Elasticsearch with tuned.match, and extend the profile these nodes already use with tuned.include: openshift-node for the worker nodes, openshift-control-plane for the infra and control plane nodes. For a demonstration, node.store.allow_mmap: false in the configuration of a node set avoids the requirement, at the cost of the performance.

Objects created by the operator

ObjectNameContent
Service of the Elasticsearch API<name>-es-httpPort 9200, HTTPS with a certificate generated by the operator
Secret of the elastic user<name>-es-elastic-userKey elastic: password of the built-in superuser
Secret of the public certificates<name>-es-http-certs-publicCertificate authority to trust when calling the API
Service of Kibana<name>-kb-httpPort 5601, HTTPS
oc -n default-eck get secret <name>-es-elastic-user -o go-template='{{.data.elastic | base64decode}}'

A route created by this chart (route.enabled) uses the passthrough termination by default: Elasticsearch or Kibana presents its own certificate, self-signed by the operator unless spec.http.tls.certificate references a tls secret. Elasticsearch can also be exposed with a service of type LoadBalancer (spec.http.service.spec.type), for example with the cluster-metallb chart.

Deploy this helm chart on openshift

1. Connect to your Openshift cluster

oc login -t <token> <cluster-url>

2. Install the repository

helm repo add startx https://helm-repository.readthedocs.io/en/latest/repos/stable/

3. Get information about this chart

helm show chart startx/cluster-eck

4. Install this chart

Default values

The default values keep every feature disabled and render nothing: the Elasticsearch clusters are specific to each environment and must be provided in a values file.

  • No Elasticsearch cluster, no Kibana instance and no node tuning are created
  • The operator subscription and namespace are managed separately via the operator and project sub-charts (both disabled by default)
# base configuration running default configuration
helm install cluster-eck startx/cluster-eck

Full deployment with operator and project

Helm cannot create a custom resource before its API exists: install the namespace and the operator first, approve its InstallPlan (the subscription uses installPlanApproval: Manual), then enable the node tuning, an Elasticsearch cluster and Kibana.

# 1. namespace and operator
helm install cluster-eck startx/cluster-eck \
  --set project.enabled=true \
  --set operator.enabled=true
oc -n openshift-operators get installplan
oc -n openshift-operators patch installplan <name> --type merge -p '{"spec":{"approved":true}}'

# 2. node tuning, Elasticsearch cluster and Kibana, once the operator is running
cat > my-eck.yaml <<EOF
tuned:
  enabled: true
elasticsearch:
  enabled: true
  list:
    - name: default
      spec:
        version: 9.5.0
        nodeSets:
          - name: default
            count: 3
            podTemplate:
              spec:
                containers:
                  - name: elasticsearch
                    resources:
                      requests:
                        cpu: "1"
                        memory: 4Gi
                      limits:
                        memory: 4Gi
            volumeClaimTemplates:
              - metadata:
                  name: elasticsearch-data
                spec:
                  accessModes:
                    - ReadWriteOnce
                  resources:
                    requests:
                      storage: 50Gi
kibana:
  enabled: true
  list:
    - name: default
      route:
        enabled: true
      spec:
        version: 9.5.0
        count: 1
        elasticsearchRef:
          name: default
EOF
helm upgrade cluster-eck startx/cluster-eck -f my-eck.yaml \
  --set project.enabled=true \
  --set operator.enabled=true

Follow the deployment with oc -n default-eck get elasticsearch,kibana: the cluster is ready when its health is green.

Other available values

  • startx : startx Elasticsearch cluster (3 nodes, 4Gi of memory and a 50Gi volume each) and its Kibana (with a route) on the infra nodes, vm.max_map_count raised on the infra nodes, operator on the infra nodes (see values-startx.yaml)
  • startx_noinfra : same deployment on the worker nodes (see values-startx_noinfra.yaml)
helm install cluster-eck startx/cluster-eck -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/cluster-eck/values-startx.yaml

Values files

Example values files shipped with the chart, to use with helm install -f <file> :

  • startx : STARTX cluster configuration, see values.yaml for the parameters (see values-startx.yaml)
  • startx_noinfra : STARTX cluster configuration, see values.yaml for the parameters (see values-startx_noinfra.yaml)
  • examples/argocd/ : 5 example manifest(s) (see the ArgoCD or usage sections)
helm install cluster-eck startx/cluster-eck -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/cluster-eck/values-startx.yaml

Deploy with ArgoCD

Deploy via ArgoCD Application

Deploy cluster-eck using three dedicated ArgoCD Applications - one per concern - all sharing the same AppProject:

git clone https://gitlab.com/startx1/helm.git
cd helm-repository/charts/cluster-eck/examples/argocd/
oc apply -k .
ApplicationWaveEnabled flagsDestination
cluster-eck-project"1"project.enabled: true, all others falsedefault-eck
cluster-eck-operator"5"operator.enabled: true (operatorGroup.enabled: false), all others falseopenshift-operators
cluster-eck-app"10"tuned, elasticsearch and kibana enabled: true, all others falsedefault-eck

The automated sync policy ensures ArgoCD reconciles each concern independently whenever the chart or values drift from the desired state. The cluster-eck-app Application also creates the Tuned resource in the openshift-cluster-node-tuning-operator namespace, the only one where the Node Tuning Operator reads it. The Subscription uses installPlanApproval: Manual: the cluster-eck-app Application stays out of sync until the InstallPlan of the operator is approved (SkipDryRunOnMissingResource=true lets the sync start before the Elastic APIs exist).

External secrets

The secrets of the secrets block (secure settings of a snapshot repository, users of the file realm, certificates) can come from an external store (Vault, AWS Secrets Manager...) through the External Secrets Operator instead of the chart values. With externalSecret.enabled: true, the chart renders an ExternalSecret producing the Secret of the same name, namespace and type, so the Elastic resource referencing it is unchanged. Without externalSecret, the chart renders the Secret from data. Never commit a real credential in a values file.

externalSecretDefaults:
  secretStoreRef:
    name: vault-backend
    kind: ClusterSecretStore
secrets:
  enabled: true
  list:
    - name: es-snapshot-s3
      externalSecret:
        enabled: true
        remoteRefs:
          s3.client.default.access_key:
            key: ocp/eck/snapshot-s3
            property: access_key
          s3.client.default.secret_key:
            key: ocp/eck/snapshot-s3
            property: secret_key
elasticsearch:
  enabled: true
  list:
    - name: default
      spec:
        version: 9.5.0
        secureSettings:
          - secretName: es-snapshot-s3
        nodeSets:
          - name: default
            count: 3

An externalSecret block accepts secretStoreRef and refreshInterval (defaults: externalSecretDefaults), remoteRefs (map of secret key to ESO remoteRef) and the raw ESO fields data, dataFrom and template. Rendering fails when no store is set or when no key source is provided.

Values dictionary

context values dictionary

KeyDefaultDescription
context.scopemyscopeName of the global scope for this application
context.clusterdefaultName of the cluster running this application
context.environmentmyenvName of the environment (dev, factory, preprod, prod)
context.componentmycomponentComponent name of this application
context.appdefault-eckApplication name
context.version3.5.0Version name of this application

externalSecretDefaults values dictionary

KeyDefaultDescription
externalSecretDefaults.apiVersionexternal-secrets.io/v1API version of the ExternalSecret CRD
externalSecretDefaults.refreshInterval1hHow often the Secret is refreshed from the external store
externalSecretDefaults.secretStoreRef.name""Name of the (Cluster)SecretStore, required as soon as a secret uses extern

Deploy cluster-eck with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cluster-eck on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcluster-eck is pinned at v21.3.412 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply