Sample Header Ad - 728x90

Kubernetes: Influxdb 1.8.10 container can’t create users

2 votes
0 answers
26 views
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 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 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 After deploy it in Kubernetes, the **Admin** user is not created during deploy, and 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 ”. How can create the Admin user during the initial deploy (like I did in docker)?
Asked by Marco Ferrara (121 rep)
May 2, 2024, 08:14 AM
Last activity: May 2, 2024, 09:13 AM