Kubernetes: Influxdb 1.8.10 container can’t create users

Hi,
I deployed on docker InfluxDB v 1.8.10 with command:

docker run --name influxdb -t
-e INFLUXDB_HTTP_AUTH_ENABLED=“true”
-e INFLUXDB_DB=“mydatabase”
-e INFLUXDB_USER=“user”
-e INFLUXDB_USER_PASSWORD=“user”
-e INFLUXDB_ADMIN_USER=“admin”
-e INFLUXDB_ADMIN_PASSWORD=“admin”
–restart unless-stopped
-d influxdb:1.8.10

When I connect I see that the new Admin user is created.

Now I would like to deploy it on Kubernetes, this is my code:


apiVersion: apps/v1
kind: StatefulSet
metadata:
name: influxdb
namespace: mon-grafana
spec:
serviceName: influxdb
replicas: 3
selector:
matchLabels:
app: influxdb
template:
metadata:
labels:
app: influxdb
spec:
containers:
- name: influxdb
image: influxdb:1.8.10 #bitnami/influxdb:1.8.10 #influxdb:1.8.10
ports:
- containerPort: 8086
name: influxdb
protocol: TCP
resources:
requests:
cpu: 250m
memory: 500Mi
limits:
cpu: 2
memory: 500Mi
env:
- name: INFLUXDB_HTTP_AUTH_ENABLED
value: “true”
- name: INFLUXDB_DB
value: “mydatabase”
- name: INFLUXDB_USER
value: “user”
- name: INFLUXDB_USER_PASSWORD
value: “user”
- name: INFLUXDB_ADMIN_USER
value: “admin”
- name: INFLUXDB_ADMIN_PASSWORD
value: “admin”
volumeMounts:
- name: pvc-influxdb
mountPath: /var/lib/influxdb
- name: influxdb-config
mountPath: “/etc/influxdb/influxdb.conf”
subPath: influxdb.conf
securityContext:
allowPrivilegeEscalation: false
volumes:
- name: influxdb-config
configMap:
name: configmap
items:
- key: influxdb.conf
path: influxdb.conf
volumeClaimTemplates:
-metadata:
name: pvc-influxdb
spec:
accessModes: [ “ReadWriteOnce” ]
resources:
requests:
storage: 2Gi

and this is my infliuxdb.conf file:

root@influxdb-0:/# cat /etc/influxdb/influxdb.conf
reporting-enabled = false

[meta]
dir = “/var/lib/influxdb/meta”

[data]
dir = “/var/lib/influxdb/data”
wal-dir = “/var/lib/influxdb/wal”
max-series-per-database = 1000000
max-values-per-tag = 100000
index-version = “tsi1”
max-index-log-file-size = “100k”

[http]
log-enabled = false
enabled = true
bind-address = “0.0.0.0:8086”
https-enabled = false
flux-enabled = true

but when I try to connect I receive this error:

root@influxdb-0:/# influx -username admin -password admin
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10

show databases;
ERR: error authorizing query: create admin user first or disable authentication
Warning: It is possible this error is due to not setting a database.
Please set a database with the command “use ”.

What did I miss?

Hmmm Im not sure it appears that the quotation marks used in your YAML file are not the standard ASCII double quotes ("). These should be simple double quotes without any formatting. For example:

env:
- name: INFLUXDB_HTTP_AUTH_ENABLED
  value: "true"
- name: INFLUXDB_DB
  value: "mydatabase"
- name: INFLUXDB_USER
  value: "user"
- name: INFLUXDB_USER_PASSWORD
  value: "user"
- name: INFLUXDB_ADMIN_USER
  value: "admin"
- name: INFLUXDB_ADMIN_PASSWORD
  value: "admin"

Can you pleases check the logs of the InfluxDB pod during startup. This can provide insights into whether there were any errors in setting up the database, initializing the admin user, or reading the configuration. You can check the logs using:

kubectl logs influxdb-0 -n mon-grafana

Also as a troubleshooting step, you might want to temporarily disable authentication to see if you can connect and execute commands successfully:

env:
- name: INFLUXDB_HTTP_AUTH_ENABLED
  value: "false"