Multiple Kapacitor Subscriptions to the Same Host

I hope that I have somewhat of a unique question to ask. Did some searching around and didn’t find anything.

I’ve dockerized Kapacitor so that I could run it on a Kubernetes cluster. One of the constraints was the exclusion of persistent storage. To get around this, we store .tick scripts as part of the container image and initialized / enable them when the container starts.

One of the side effects of this however is that each time the docker container runs, it renews its subscriptions to influxDB. As a result influx ends up having multiple subscriptions to the same hostname, but a different ID. I’ve observed that when there are more than one subscription to same host, Kapacitor no longer receives data on that hostname.

Any thoughts?

Best Regards,
Stephen

First you can avoid the issue by baking the ID into the container, but beware this will break if you ever run two containers against the same InfluxDB. To bake in the IDs just check the contents of /var/lib/kapacitor/cluster.id.

Second, subscriptions should continue to work when there are other old subscriptions still configured, but they will log lots of errors. Can you provide more details on this case?

I can try to provide whatever you’re interested in. Was there something in particular that you’d like me to clarify or expand on?

hey @nathaniel I hardcoded the cluster.id inside the docker container, but noticed that Kapacitor still makes a new subscription to influx.

b14b93c6-111b-46e1-b7ac-d70e7c11e6f2

influxdb subscriptions : notice that it created a new one even though one with the above cluster.id exists already:

                    "values": [
                   
                        [
                            "autogen",
                            "kapacitor-b14b93c6-111b-46e1-b7ac-d70e7c11e6f2",
                            "ANY",
                            [
                                "http://host:29092"
                            ]
                        ],
                        [
                            "autogen",
                            "kapacitor-6f40d80a-5b41-42d6-aaaf-cc4d60520c00",
                            "ANY",
                            [
                                "http://host:29092"
                            ]
                        ]
                    ]