elasticsearch-data

by empathy.co

Helm chartv0.2.0App 6.6.2

A Helm chart for Kubernetes

About this chart

Elasticsearch-data Helm Chart

This Helm chart is Empathy's own Helm chart (based on the official Elasticsearch Helm chart) to deploy data and ingest Elasticsearch 6.6.2 nodes with a custom Dockerfile habilitating unlimited memory lock (ulimit -l unlimited). Additionally, justwatchcom Elasticsearh Exporter is deployed as a sidecar container to expose Prometheus metrics in port 9114.

N.B. Please note this Helm chart is specifically tailored to deploy Elasticsearch nodes with the data and ingest roles. For a fully functional Elasticsearch deployment you will have to also deploy Elasticsearch master nodes which can be achieved with Empathy's Elasticsearch-master Helm chart.

Requirements

  • Kubernetes >= 1.14
  • Helm 3
  • Minimum cluster requirements include the following to run this chart with default settings.
    • Three Kubernetes nodes to respect the topologyKey: "kubernetes.io/hostname" antiaffinity.
    • 3GB of RAM for the JVM heap.
    • 1 vCPU available for resource limits.
    • 200Gi of capacity for each persistent volume.

Installing

To install the chart with the release name es-data and default values, run:

$ helm repo add empathy-public https://empathyco.github.io/helm-charts
$ helm install es-data empathy-public/elasticsearch-data

Uninstalling the Chart

To uninstall/delete the es-data deployment:

$ helm delete es-data

The command removes all the Kubernetes components associated with the chart and deletes the release.

Usage notes

  • The chart deploys a StatefulSet and by default will do an automated rolling update of your cluster. It does this by waiting for the cluster health to become green after each instance is updated. If you prefer to update manually you can set OnDelete updateStrategy.
  • It is important to verify that the JVM heap size in elastic_config.ES_JAVA_OPTS and to set the CPU/Memory resources to something suitable for your cluster.
  • To simplify chart and maintenance each set of node groups is deployed as a separate Helm release, this chart referring to nodes with the data and ingest roles, while the Empathy's Elasticsearch-master Helm chart handles master nodes. This is basically the idea expressed in the official Elasticsearch Helm chart multi example. Without doing this it isn't possible to resize persistent volumes in a StatefulSet. By setting it up this way it makes it possible to add more nodes with a new storage size then drain the old ones. It also solves the problem of allowing the user to determine which node groups to update first when doing upgrades or changes.
  • Although based on the official Elasticsearch Helm Chart and the multi example mentioned in the previous point, this chart is much more opinionated that the official Helm chart. It is only thought to deploy nodes with the data and index roles, not masters, with the justwatchcom Elasticsearh Exporter and a custom docker image of Elastic 6.6.2 with an unlimited memory lock. Please make sure this chart fits your needs before using it.
  • Please note the following if used in combination with Empathy's Elasticsearch-master Helm chart:
    • Both charts must have the same elastic_config."cluster.name" value so that they belong to the same Elasticsearch cluster
    • Both charts must have the same elastic_config."discovery.zen.ping.unicast.hosts" value to connect. This value depends on the Elasticsearch-master chart release name as <RELEASE_NAME>-elasticsearch-master-discovery.

Values

KeyTypeDefaultDescription
busybox.imagestring"busybox:1.31"Image for busybox initContainers (sysctlInitContainer in official Elasticsearch Helm chart)
elastic_configobject{"ES_JAVA_OPTS":"-Xms2048m -Xmx2048m","bootstrap.memory_lock":"true","cluster.name":"test-es","logger.org.elasticsearch.discovery.gce":"TRACE","network.bind_host":"0.0.0.0","node.attr.type":"search","node.data":"true","node.ingest":"true","node.master":"false","node.ml":"false","transport.tcp.compress":"true"}Elasticsearch configuration added in a configMap and passed to the Elasticsearch pods as Env. Vars.
elastic_config."bootstrap.memory_lock"string"true"Elasticsearch enable memory lock to avoid swapping
elastic_config."cluster.name"string"test-es"Elasticsearch cluster.name and should be unique per cluster in the namespace. If using the elasticsearch-master Helm chart, this value should be the same for both charts in order to belong to the same cluster.
elastic_config."logger.org.elasticsearch.discovery.gce"string"TRACE"Elasticsearch GCE discovery log level
elastic_config."network.bind_host"string"0.0.0.0"Elasticsearch network.bind_host, network address(es) to which the node should bind in order to listen for incoming connections.
elastic_config."node.attr.type"string"search"Elasticsearch node attribute type
elastic_config."node.data"string"true"Elasticsearch data node role
elastic_config."node.ingest"string"true"Elasticsearch ingest node role
elastic_config."node.master"string"false"Elasticsearch master node role
elastic_config."node.ml"string"false"Elasticsearch ml node role
elastic_config."transport.tcp.compress"string"true"Elasticsearch enable compression between nodes
elastic_config.ES_JAVA_OPTSstring"-Xms2048m -Xmx2048m"Elasticsearch JVM options
fullnameOverridestring""Overrides the clusterName and nodeGroup when used in the naming of resources. This should only be used when using a single nodeGroup, otherwise you will have name conflicts
image.pullPolicystring"IfNotPresent"The Kubernetes imagePullPolicy value
image.repositorystring"empathyco/elasticsearch"Docker repository for Elasticsearch image
image.tagstring"6.6.2-memlock"Overrides the image tag whose default is the chart appVersion.
imagePullSecretslist[]Configuration for imagePullSecrets so that you can use a private registry for your image
ingress.annotationsobject{}Annotations for Kubernetes Ingress
ingress.classNamestring""IngressClass name for ingress exposition
ingress.enabledboolfalseEnable Kubernetes Ingress to expose Elasticsearch pods
ingress.hostslist[]Host and path for Kubernetes Ingress. See values.yaml for an example
ingress.tlslist[]TLS secret for exposing Elasticsearch with https. See values.yaml for an example
masterFullnamestring"es-test-elasticsearch-master"Fullname of the master, necessary to connect
nameOverridestring""Overrides the clusterName when used in the naming of resources
nodeSelectorobject{}Configurable nodeSelector so that you can target specific nodes for your Elasticsearch cluster
podAnnotationsobject{}Configurable annotations applied to all Elasticsearch pods
podSecurityContextobject{}Allows you to set the securityContext for the pod
podSecurityPolicy.createboolfalseCreate a podSecurityPolicy with minimal permissions to run this Helm chart. Be sure to also set rbac.create to true, otherwise Role and RoleBinding won't be created.
podSecurityPolicy.namestring""The name of the podSecurityPolicy to use. If not set and create is true, a name is generated using the fullname template
podSecurityPolicy.specobject{}Spec to apply to the podSecurityPolicy. See values.yaml for an example
prometheus.annotationsobject{"app":"prometheus-operator","release":"prometheus"}Annotations to include in the ServiceMonitor
prometheus.enabledboolfalseDeploy a ServiceMonitor for Prometheus scrapping
prometheus.exporter.imagestring"justwatch/elasticsearch_exporter:1.1.0"Exporter image to deploy as a sidecar container
rbac.createboolfalseWhether RBAC rules should be created (Role and Rolebinding)
replicaCountint3Kubernetes replica count for the StatefulSet (i.e. how many pods)
resources.limits.cpustring"1000m"CPU limits for the StatefulSet
resources.limits.memorystring"3Gi"Memory limits for the StatefulSet
resources.requests.cpustring"1000m"CPU requests for the StatefulSet
resources.requests.memorystring"3Gi"Memory requests for the StatefulSet
securityContextobject{"capabilities":{"add":["IPC_LOCK","SYS_RESOURCE"]}}Allows you to set the securityContext for the container
service.portint9200Kubernetes service port, used by Ingress to expose Elasticsearch pods
service.typestring"ClusterIP"Kubernetes service type
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
tolerationslist[]Configurable tolerations
volume.annotationsobject{}Annotations for statefulSet volumes
volume.storagestring"200Gi"Storage resources for statefulSet volumes
volume.storage_classstring"standard"Storage class for statefulSet volumes

Autogenerated from chart metadata using helm-docs v1.5.0

Deploy elasticsearch-data with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has elasticsearch-data 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 chartelasticsearch-data is pinned at v0.2.0 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