Helm, Kapacitor and Tick scripts


I’ve deployed Telegraf, Influx, Kapacitor and Chronograf on Kubernetes using Helm.
I’ve written some Tick scripts using the Chronograf UI to generate alerts on my data.
I’m puzzled how to automate deployment of those Tick scripts.

If I were working with Kubernetes manifests, I could probably add in a config map containing my Tick scripts, however, I’m using ArgoCD to deploy the Helm charts and am constrained by what is supported in github influxdata/helm-charts/tree/master/charts/kapacitor

This seems to be what I’m looking for, but never got merged:

This also seems to do what I want, but isn’t supported via Helm (unless I can use the sidecar option to load the directory structure and pass in the [load] config as environmental variables? Its not clear what the sidecar option is for)

A similar community post gives me the idea that maybe I can log into the Kapacitor pod post deployment and load the scripts that way (user wrote a shell script, unfortunately I’ve hit my link limit)

Would really appreciate some community suggestions how to do this!

On the sideload option, if I add a config map containing my tick script:

 % cat kapacitor-sideload-tickscript-test.yaml 
apiVersion: v1
kind: ConfigMap
  name: kapacitor-sideload-tickscript-test
    kapacitor_sideload: "1"
  test.tick: |
    dbrp "telegraf"."autogen"
    var  data = batch
      |query('Select.... etc

and use the sideload option to filter for and load this:

cat values.yaml
  influxURL: 'http://influxdb:8086'
      enabled: true
      label: kapacitor_sideload

I can see my tick script in /var/lib/kapacitor/sideload inside the kapacitor pod deployed via helm. However, I still need to run kapacitor commands to add it, i.e “kapacitor define test -tick test.tick” etc.

If I could modify /etc/kapacitor/kapacitor.conf [load] section to point at /var/lib/kapacitor/sideload (or change the sideload folder to /etc/kapacitor/load if [load] is enabled by default) then maybe I could get this working, but I think I’m overusing the sideload node to get my tick scripts auto deployed?

Very confused how I can redeploy kapacitor using helm with all my tick scripts executing out of the box…


Ok, not sure if this is how sideload is intended to be used, but it seems to work:

cat values.yaml 

  influxURL: 'http://influxdb:8086'
      enabled: true
      label: kapacitor_sideload
      folder: /var/lib/kapacitor/sideload/tasks 
    KAPACITOR_LOAD_DIR: /var/lib/kapacitor/sideload

With the tick scripts I want available as config maps, when I deloy kapacitor with helm the tick scripts/tasks are running out of the box!

1 Like

You might find some helpful examples here: