I am trying to setup an automated influxdb instance using kubernetes, nothing too exotic I thought, but : I need to run the "influx setup ...." command for the initial setup, and this needs to be ran after the daemon is started (obviously).
I tried multiple syntax inside the deploy yaml, here is one attempt:
spec:
containers:
- name: influxdb-test
image: influxdb:2.0.7
command:
- sh
- "-c"
- |
/bin/bash <<'EOF'
influxd&
influx setup --org ORG --bucket dummy --username USER --password USER --force
EOF
But this gives me the following error :
Error: failed to determine if instance has been configured: Get "http://localhost:8086/api/v2/setup": dial tcp 127.0.0.1:8086: connect: connection refused
See 'influx setup -h' for help
Well I do not need a solution for this specific error, but more a solution about how can I have a daemon running (influxd) and run some command after this daemon (influx setup) and then keep the container up.
I first thought that adding the simple "influx setup" command would be enough, but any command given inside a yaml deploy file overwrite the container initial command (influxd in this case) so I tried to reproduce the whole stuff manually : start the daemon, then run the setup then I am done, but no luck.
Of course I am a k8s newbie.
I am looking at "init container" as this sounds close to fixing my issue ....