avatarAsanka Vithanage

Summary

The web content provides a detailed guide on deploying InfluxDB 2.0 on a Kubernetes cluster using Bitnami's Helm chart, including customization, installation, setup, and access methods.

Abstract

The article outlines the process of deploying InfluxDB version 2.0.6, an open-source time series database, on a Kubernetes cluster using Helm charts provided by Bitnami. It highlights the differences between InfluxDB versions 1.x.x and 2.x.x, emphasizing the new features introduced in version 2. The guide includes instructions on customizing the Helm chart values.yaml file for persistence, installing the chart with Helm commands, and verifying the deployment status. It also addresses the initial setup process for InfluxDB, which involves creating a default organization, user, bucket, and admin authentication token. The article provides steps for resetting the admin user's password when necessary and discusses methods for accessing InfluxDB, such as through its UI, CLI, API, and Telegraf plugins. The author notes a challenge with exposing the InfluxDB UI through a reverse proxy and offers a workaround using kube-proxy. The conclusion encourages users to explore and enjoy the features of InfluxDB 2.0.

Opinions

  • The author prefers Bitnami's Helm chart over Influxdata's due to its superior customization support.
  • The author finds the initial setup process with Bitnami's Helm chart convenient as it automatically creates necessary components like the "primary" organization and bucket, as well as an admin user.
  • There is an expressed difficulty in retrieving the admin user credentials after deployment, necessitating a password reset.
  • The author points out an ongoing issue with exposing the InfluxDB 2.0 web application using a reverse proxy via context path, which may affect users relying on this method for external access.
  • The author's tone suggests a positive experience with InfluxDB 2.0's deployment and features, encouraging readers to engage with the database's user-friendly interface and capabilities.

Deploying InfluxDB2 server with helm chart

InfluxDB is an open-source time series database developed by InfluxData. InfluxDB is purpose-built to collect, store, process and visualize metrics and events, specially used lot on the operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics fields.

As of writing InfluDb v2.0.6 is the latest version and InfluxDb has released v2.0.0 around November 2020. Before that they were releasing v1.x.x versions.

I wanted to highlight these versions specifically, since InfluxDb v1.x.x and v2.x.x versions has many differences.

Following articles gives some context on InfluxDB v2 new features.

  1. https://www.influxdata.com/blog/influxdb-2-0-open-source-is-generally-available/
  2. https://www.influxdata.com/blog/introducing-the-next-generation-influxdb-2-0-platform/

Also, need to note InfluxDB got two versions called opensource and Enterprise as well.

Here, I am trying to explain how the opensource InfluxDB v2 can be installed on a Kubernetes cluster using Helm charts.

Influxdata team developed helm charts can be found on the git repo https://github.com/influxdata/helm-charts/tree/master/charts/influxdb2

Also another helm chart developed by bitnami team available on the git repo https://github.com/bitnami/charts/tree/master/bitnami/influxdb

After evaluating two charts, I decided to go with the bitnami chart since it had more customization support.

You can grab the values.yaml file from the bitnami github and change the parameters as per your requirements.

In my case, I enabled persistence and tried to use an existingClaim. See sample below

## Persistence parameters
##
persistence:
  enabled: true
  ## A manually managed Persistent Volume and Claim
  ## If defined, PVC must be created manually before volume will be bound
  ## The value is evaluated as a template
  ##
  existingClaim: influxdb2-pv-claim

Then, Installed helm chart with below commands

helm repo add bitnami https://charts.bitnami.com/bitnami
helm upgrade --install influxdb2-release bitnami/influxdb -f /Users/asankav/code/influx/bitnami/values.yaml

Helm install command returns the following results on the shell

Release "influxdb2-release" does not exist. Installing it now.
NAME: influxdb2-release
LAST DEPLOYED: Fri May 28 13:45:46 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
InfluxDB(TM) can be accessed through following DNS names from within your cluster:
    InfluxDB(TM): influxdb2-release.default.svc.cluster.local (port 8086)
To connect to your database run the following commands:
kubectl run influxdb2-release-client --rm --tty -i --restart='Never' --namespace default  \
        --image docker.io/bitnami/influxdb:2.0.6-debian-10-r22 \
        --command -- influx -host influxdb2-release -port 8086
To connect to your database from outside the cluster execute the following commands:
kubectl port-forward svc/influxdb2-release 8086:8086 & influx -host 127.0.0.1 -port 8086

As above helm response mentioned, wait till pod geting created and comes to running status.

Usekubectl get pods command to check the pod status

NAME READY   STATUS    RESTARTS   AGE
influxdb2-release-8584d51234-wdgsg 1/1 Running 0 2m

To make InfluxDB server operational, We need to setup the InfluxDB via the initial setup process. The initial setup process will walks through creating a default organization, user, bucket, and Admin authentication token.

Refer https://docs.influxdata.com/influxdb/v2.0/get-started/?t=Kubernetes#set-up-influxdb for steps.

Note:

When influxDB deployed with bitnami helm chart, Its not required to setup influxDB as mentioned above, deployment will be created with a bucket called “primary” on an organization called “primary”. admin user also will be created.

But I couldn't figure out a way to get admin user credentials. So I had to reset the admin password using influxDB CLI, See the detail steps below.

Now, We successfully deployed InfluxDb v2 on the kubernetes cluster. Its time to get access and play around with it.

Users can use one of the below aproaches to connect and interact with the InfluxDB.

Telegraf plugins,

InfluxDB v2 API,

influx command line interface (CLI),

InfluxDB UI (the user interface for InfluxDB 2.0),

InfluxDB v2 API client libraries.

Here, I will use InfluxDB UI to get access and go though the application.

In Kubernetes, We have to expose InfluxDB UI using a reverse proxy like nginx Ingress to make it accessible from outside. or else can use kube proxy to get access to the web application temporally.

But just to note, there is a ongoing issue when trying to expose the influxdb2 web application using reverse proxy via context path.

Get access to the web application via kube proxy, using below command

kubectl port-forward svc/influxdb2-release 8086:8086 & influx -host 127.0.0.1 -port 8086

Access InfluxDB web application using link http://localhost:8086/signin

As explained in a previous section, Now the question is whats the admin user’s password. I couldn't find a way to get it, hence I reset the password using below commands.

View the influxDB config file and Grab the access token

kubectl exec -it influxdb2-release-8584d55674-bbmbq -- cat /bitnami/influxdb/configs

Check the [default] section on the config and get the access token value.

Now reset the password using below command, make sure to provide the grabbed token with -t token_value flag

kubectl exec -it influxdb2-release-8584d55674-bbmbq -- influx user password -n admin -t Vh9HzNML132tNtS72eW

Now we got both username and password, Enter those credentials and login to the applicaiton.

Now you can go to the Data section and create new buckets

New Organization can be created using the following section

— — — — — — —😁 😬 Play around it and Enjoy 😬😁 — — — — — — — 🇱🇰— —

Influxdb
Helm
Kubernetes
Recommended from ReadMedium