elastalert2

by kfirfer

Helm chartv2.2.5App 2.2.3

Automated rule-based alerting for Elasticsearch

About this chart

ElastAlert 2 Helm Chart for Kubernetes

An ElastAlert 2 helm chart is available in the jertel Helm repository, and can be installed into an existing Kubernetes cluster by following the instructions below.

Installing the Chart

Add the jertel repository to your Helm configuration:

helm repo add jertel https://helm.jertel.com

Next, install the chart with a release name, such as elastalert2:

helm install elastalert2 jertel/elastalert2

The command deploys ElastAlert 2 on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

See the comment in the default values.yaml for specifying a writebackIndex for ES 5.x.

If necessary, open Dev Tools on Kibana and send the below request to avoid errors like RequestError: TransportError(400, u'search_phase_execution_exception', u'No mapping found for [alert_time] in order to sort on')

PUT /elastalert/_mapping/elastalert
{
  "properties": {
      "alert_time": {"type": "date"}
  }
}

Uninstalling the Chart

To uninstall/delete the ElastAlert 2 deployment:

helm delete elastalert2 --purge

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

Configuration

ParameterDescriptionDefault
image.repositorydocker imagejertel/elastalert2
image.tagdocker image tag2.2.3
image.pullPolicyimage pull policyIfNotPresent
image.pullSecretimage pull secret""
podAnnotationsAnnotations to be added to pods{}
podSecurityContextConfigurable podSecurityContext for pod execution environment{"runAsUser": 1000, "runAsGroup": 1000, "fsGroup": 1000}
securityContextAllows you to set the securityContext for the container{"runAsNonRoot": true, "runAsUser": 1000}
commandcommand override for containerNULL
argsargs override for containerNULL
replicaCountnumber of replicas to run1
elasticsearch.hostelasticsearch endpoint to useelasticsearch
elasticsearch.portelasticsearch port to use9200
elasticsearch.useSslwhether or not to connect to es_host using SSLFalse
elasticsearch.usernameUsername for ES with basic authNULL
elasticsearch.passwordPassword for ES with basic authNULL
elasticsearch.credentialsSecretSpecifies an existing secret to be used for the ES username/password authNULL
elasticsearch.credentialsSecretUsernameKeyThe key in elasticsearch.credentialsSecret that stores the ES password authNULL
elasticsearch.credentialsSecretPasswordKeyThe key in elasticsearch.credentialsSecret that stores the ES username authNULL
elasticsearch.verifyCertswhether or not to verify TLS certificatesTrue
elasticsearch.clientCertpath to a PEM certificate to use as the client certificate/certs/client.pem
elasticsearch.clientKeypath to a private key file to use as the client key/certs/client-key.pem
elasticsearch.caCertspath to a CA cert bundle to use to verify SSL connections/certs/ca.pem
elasticsearch.certsVolumescerts volumes, required to mount ssl certificates when elasticsearch has tls enabledNULL
elasticsearch.certsVolumeMountsmount certs volumes, required to mount ssl certificates when elasticsearch has tls enabledNULL
extraConfigOptionsAdditional options to propagate to all rules, cannot be alert, type, name or index{}
secretConfigNamename of the secret which holds the ElastAlert config. Note: this will completely overwrite the generated configNULL
secretRulesNamename of the secret which holds the ElastAlert rules. Note: this will overwrite the generated rulesNULL
secretRulesLista list of rules to enable from the secret[]
optEnvAdditional pod environment variable definitions[]
extraVolumesAdditional volume definitions[]
extraVolumeMountsAdditional volumeMount definitions[]
serviceAccount.createSpecifies whether a service account should be created.true
serviceAccount.nameService account to be used. If not set and serviceAccount.create is true, a name is generated using the fullname template
serviceAccount.annotationsServiceAccount annotations
podSecurityPolicy.create[DEPRECATED] Create pod security policy resourcesfalse
resourcesContainer resource requests and limits{}
rulesRule and alert configuration for ElastAlert 2{} example shown in values.yaml
runIntervalMinsDefault interval between alert checks, in minutes1
realertIntervalMinsTime between alarms for same rule, in minutesNULL
alertRetryLimitMinsTime to retry failed alert deliveries, in minutes2880 (2 days)
bufferTimeMinsDefault rule buffer time, in minutes15
writebackIndexName or prefix of elastalert index(es)elastalert
nodeSelectorNode selector for deployment{}
affinityAffinity specifications for the deployed pod(s){}
tolerationsTolerations for deployment[]

Deploy elastalert2 with OpenTenant

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