Authorization Issue with InfluxDB on cluster

2.6k Views Asked by At

I am new to the realm of helm & kubernetes in general and need to install influxdb onto a cluster. I've generated said cluster using kind and installed influxdb onto it as a helm release. When I host the cluster onto 8086, if I run a query to create a database (or any other command), I get the following error:

Input

curl iXPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABSE "mydb"'

Output

HTTP/1.1 401 Unauthorized
Content-type: application/json; charset=utf-8
X-Platform-Error-code: unauthorized
Date: Wed, 05 May 2021 16:17:54 GMT
Content-Length: 48

{"code":"unauthorized","message":"unauthorized"}

As far as I understand, authorization should be by default disabled for influxdb (see section 'Start with authentication', auth-enabled should be default false), so I'm confused as to why I'm bumping into this error. I've tried issuing HTML commands to create an admin and am met with the same issue (obviously). Has anyone seen this before or know what's up?

Additionally, I'm working from windows and do not have the influxdb CLI installed.

Thanks.

1

There are 1 best solutions below

0
On

Influx database doesn't allow to create the data by default below are the conditions needs to met before you start working on the queries:

  1. Disable https=false in influxdb.conf file Link

  2. Run the influx service and connect to command to create the user and create database and then grant the permission to your database Link

    CREATE USER test WITH PASSWORD 'password' WITH ALL PRIVILEGES
    
  3. Now you can enable the https with the secure connection

If all above condition met then by using the username and password you can make the connect and perform the operation on db

Follow this document for setup https://influxdbcom.readthedocs.io/en/latest/content/docs/v0.9/administration/administration/