influxdata / influxdata-docker

Official docker images for the influxdata stack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

influxdb:1.8.10 when deploy it on kubernetes don't create admin user

marcoferraraUK opened this issue · comments

I deployed this container on docker, and it has created correctly the admin user:

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 

If I try do deploy the same container in Kubernetes the admin user is not created if the env variable INFLUXDB_HTTP_AUTH_ENABLED is set to true.

apiVersion: apps/v1
kind: StatefulSet
metadata:
    name: influxdb
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-http
          protocol: TCP
        env:
        - name: INFLUXDB_ADMIN_USER
          value: "admin"
        - name: INFLUXDB_ADMIN_PASSWORD
          value: "admin"
        - name: INFLUXDB_HTTP_AUTH_ENABLED
          value: "true"
        securityContext:
          allowPrivilegeEscalation: false

my /etc/influxdb/influxdb.conf

reporting-enabled = false

[meta]
dir = "/var/lib/influxdb/meta"

[data]
dir = "/var/lib/influxdb/data"
#engine = "tsm1"
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]
enabled = true
bind-address = ":8086"
log-enabled = false
#auth-enabled = true
https-enabled = false
#https-certificate ="/etc/ldap/ssl/cert.pem"
#https-private-key ="/etc/ldap/ssl/key.pem"
flux-enabled = true

My kube version:

root@i-07f6d8752e8d92e7a:/opt/_out/grafana# kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.0

If I disable INFLUXDB_HTTP_AUTH_ENABLED create the admin user but the authentication is not enabled.