elasticsearch-master

by empathy.co

Helm chartv0.3.0App 6.6.2

A Helm chart for Kubernetes

About this chart

Elasticsearch-mata Helm Chart

This Helm chart is Empathy's own Helm chart (based on the official Elasticsearch Helm chart) to deploy master 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. Additionally, a Grafana dashboard is automatically deployed for monitoring Elasticsearch in namespace monitoring.

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

Installing

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

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

Uninstalling the Chart

To uninstall/delete the es-master deployment:

$ helm delete es-master

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

Usage notes

  • The chart deploys a Deployment 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 master roles, while the Empathy's Elasticsearch-data 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 master roles, not data nodes, 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-data 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 (this 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","discovery.zen.minimum_master_nodes":"1","network.bind_host":"0.0.0.0","node.data":"false","node.ingest":"false","node.master":"true","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-data Helm chart, this value should be the same for both charts in order to belong to the same cluster.
elastic_config."discovery.zen.minimum_master_nodes"string"1"Minimum number of master eligible nodes that need to join a newly elected master in order for an election to complete and for the elected node to accept its mastership.
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. Please note that the "es-master" part of the example should be the same as this chart release name, and that the elasticsearch-data charts should use the same value for discovery.zen.ping.unicast.hosts to connect.
elastic_config."node.data"string"false"Elasticsearch data node role
elastic_config."node.ingest"string"false"Elasticsearch ingest node role
elastic_config."node.master"string"true"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.annotationsstringnilAnnotations 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
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 Deployment (i.e. how many pods)
resources.limits.cpustring"1000m"CPU limits for the Deployment
resources.limits.memorystring"3Gi"Memory limits for the Deployment
resources.requests.cpustring"1000m"CPU requests for the Deployment
resources.requests.memorystring"3Gi"Memory requests for the Deployment
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"5Gi"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-master with OpenTenant

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