InfluxDB as "Infrastructure As Code"

Hello everyone,

I’m working in a project which involves running Grafana and InfluxDB 2.X in a kubernetes environment. One of the requirements for this project, is making it all IaC infrastructure as code, which obviously does not come without it’s challenges.

What I’m currently struggling with is defining the credentials to access InfluxDB before even deploying it. What do I mean by this? Well this is a IaC project, which means I cannot manually go into InfluxDB and generate the credentials, InfluxDB just have to startup with the whole thing predefined.

Here is what I have tried:

My first thought, were to use basic authentication, and simply create a new user with predefined username and password. Then give the same username/password to Grafana. However InfluxDB does not seem to accept this, as it keeps returning 401 and in the logs it yield:

lvl=info msg=Unauthorized log_id=0dl2tKLW000 error="token required"

To me this seem wierd, since you are clearly able to create users with username and password, however if you the end are forced to use a token, I don’t see the purpose of basic auth.

My second thought, were to find a way to predefined the token value. However this does not seem possible, as the token value seem to be randomly generated.

Would appreciate any help or clarification on this topic.

Hello @RasmusGodske,
You can setup the token with docker:
Here’s an example: