I'd like to run InfluxDB2 in a docker container in Kubernetes, and I'd like to avoid having to manually setup a user. I do know from https://hub.docker.com/_/influxdb that it's possible to do this using environment variables, and I've made that work, but I'd like to do this using a kubernetes secret instead and mount that as the file /etc/influxdb2/influx-configs in the container.
I have this secret:
apiVersion: v1
kind: Secret
metadata:
name: influxdb-org-user-auth-secret
stringData:
influx-configs: |+
[default]
url = "http://localhost:8086"
token = "token_token_token_token"
org = "initial_organization"
active = true
And I'm mounting it like this in my statefulset:
...
volumeMounts:
- name: influxdb-org-user-auth
readOnly: true
mountPath: "/etc/influxdb2"
...
volumes:
- name: influxdb-org-user-auth
secret:
secretName: influxdb-org-user-auth-secret
And this seems to work. If I go into the container I can see this:
I have no name!@influxdb-0:/$ cat /etc/influxdb2/influx-configs
[default]
url = "http://localhost:8086"
token = "token_token_token_token"
org = "initial_organization"
active = true
I can also see that it seems to be a symbolic link:
I have no name!@influxdb-0:/$ ls -ahl /etc/influxdb2/influx-configs
lrwxrwxrwx 1 root 20000 21 May 5 10:49 /etc/influxdb2/influx-configs -> ..data/influx-configs
However, if I port forward (kubectl -n observability port-forward influxdb-0 8086:8086) and open browser at http://localhost:8086 I'm redirected to http://localhost:8086/onboarding/0, which seems to indicate that my efforts failed.
Here are the initial logs of the influxdb container:
chmod: changing permissions of '/var/lib/influxdb2': Operation not permitted
chmod: changing permissions of '/etc/influxdb2': Read-only file system
2022-05-05T10:49:57.580064860Z warn boltdb not found at configured path, but DOCKER_INFLUXDB_INIT_MODE not specified, skipping setup wrapper {"system": "docker", "bolt_path": ""}
ts=2022-05-05T10:49:57.703727Z lvl=info msg="Welcome to InfluxDB" log_id=0aGyIUml000 version=2.1.1 commit=657e1839de build_date=2021-11-09T03:03:48Z
ts=2022-05-05T10:49:57.707452Z lvl=info msg="Resources opened" log_id=0aGyIUml000 service=bolt path=/var/lib/influxdb2/influxd.bolt
ts=2022-05-05T10:49:57.707518Z lvl=info msg="Resources opened" log_id=0aGyIUml000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
ts=2022-05-05T10:49:57.708371Z lvl=info msg="Bringing up metadata migrations" log_id=0aGyIUml000 service="KV migrations" migration_count=18
ts=2022-05-05T10:49:57.797799Z lvl=info msg="Bringing up metadata migrations" log_id=0aGyIUml000 service="SQL migrations" migration_count=3
ts=2022-05-05T10:49:57.805939Z lvl=info msg="Using data dir" log_id=0aGyIUml000 service=storage-engine service=store path=/var/lib/influxdb2/engine/data
ts=2022-05-05T10:49:57.805974Z lvl=info msg="Compaction settings" log_id=0aGyIUml000 service=storage-engine service=store max_concurrent_compactions=8 throughput_bytes_per_second=50331648 throughput_bytes_per_second_burst=50331648
ts=2022-05-05T10:49:57.805986Z lvl=info msg="Open store (start)" log_id=0aGyIUml000 service=storage-engine service=store op_name=tsdb_open op_event=start
ts=2022-05-05T10:49:57.806024Z lvl=info msg="Open store (end)" log_id=0aGyIUml000 service=storage-engine service=store op_name=tsdb_open op_event=end op_elapsed=0.037ms
ts=2022-05-05T10:49:57.806043Z lvl=info msg="Starting retention policy enforcement service" log_id=0aGyIUml000 service=retention check_interval=30m
ts=2022-05-05T10:49:57.806049Z lvl=info msg="Starting precreation service" log_id=0aGyIUml000 service=shard-precreation check_interval=10m advance_period=30m
ts=2022-05-05T10:49:57.806082Z lvl=info msg="Starting query controller" log_id=0aGyIUml000 service=storage-reads concurrency_quota=1024 initial_memory_bytes_quota_per_query=9223372036854775807 memory_bytes_quota_per_query=9223372036854775807 max_memory_bytes=0 queue_size=1024
ts=2022-05-05T10:49:57.806839Z lvl=info msg="Configuring InfluxQL statement executor (zeros indicate unlimited)." log_id=0aGyIUml000 max_select_point=0 max_select_series=0 max_select_buckets=0
ts=2022-05-05T10:49:58.091674Z lvl=info msg=Listening log_id=0aGyIUml000 service=tcp-listener transport=http addr=:8086 port=8086
ts=2022-05-05T10:49:58.091705Z lvl=info msg=Starting log_id=0aGyIUml000 service=telemetry interval=8h
Should this be possible? If so, what am I missing? Thanks for reading! (Also asked here: https://github.com/influxdata/influxdata-docker/issues/611)