'Apply node-specific DaemonSet configuration
I've got 4 nodes in a kubernetes cluster and a metric exporter for prometheus that has to run on each node, each one exposing the nodes individual metrics. This exporter fetches the necessary data via UDP from another deployment, lets call it provider, on the same node.
So, the desired setup looks like this:
node01:
- exporter01
- provider01
node02:
- exporter02
- provider02
[...]
One would guess, okay if exporter
and provider
are needed on all nodes each, lets use a DaemonSet
for it and kubernetes will spread the deployments across the nodes. It's unfortunately not so easy because exporter
and provider
are configured via ENVs, say IP
and Port
, so their communication via UDP works. So, each of these pods have to be configured differently which, afaik, is not possible with a DaemonSet
.
Question
I could achieve this probably with 4 different deployments with a nodeSelector
each. Similarly, I could create 4 services for the provider
instances so the exporter
could reach it this way.
But is there a better solution that, ideally, doesnt require 4 resources that are 90% the same?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|