Difference between revisions of "Influxdb"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "https://github.com/influxdata/influxdata-operator")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
https://github.com/influxdata/influxdata-operator
+
#
 +
https://docs.influxdata.com/influxdb/v2.2/
 +
 
 +
# Install on k8s via helm
 +
https://artifacthub.io/packages/helm/influxdata/influxdb
 +
 
 +
 
 +
# Apt install and general config
 +
https://computingforgeeks.com/install-influxdb-on-ubuntu-and-debian/
 +
 
 +
 
 +
 
 +
 
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
- https://github.com/influxdata/influxdata-operator
 +
 
 +
# k8s
 +
 
 +
- https://medium.com/starschema-blog/monitor-your-infrastructure-with-influxdb-and-grafana-on-kubernetes-a299a0afe3d2
 +
 
 +
```
 +
kubectl create secret generic influxdb-creds \
 +
  --from-literal=INFLUXDB_DB=monitoring \
 +
  --from-literal=INFLUXDB_USER=user \
 +
  --from-literal=INFLUXDB_USER_PASSWORD=<password> \
 +
  --from-literal=INFLUXDB_READ_USER=readonly \
 +
  --from-literal=INFLUXDB_USER_PASSWORD=<password> \
 +
  --from-literal=INFLUXDB_ADMIN_USER=root \
 +
  --from-literal=INFLUXDB_ADMIN_USER_PASSWORD=<password> \
 +
  --from-literal=INFLUXDB_HOST=influxdb  \
 +
  --from-literal=INFLUXDB_HTTP_AUTH_ENABLED=true
 +
```
 +
Next, create some persistent storage to store the database itself:
 +
```
 +
---
 +
apiVersion: v1
 +
kind: PersistentVolumeClaim
 +
metadata:
 +
  namespace: monitoring
 +
  labels:
 +
    app: influxdb
 +
  name: influxdb-pvc
 +
spec:
 +
  accessModes:
 +
  - ReadWriteOnce
 +
  resources:
 +
    requests:
 +
      storage: 10Gi
 +
```
 +
If you are new to Kubernetes, the way to execute these files is to call kubectl apply -f <filename> , in our case kubectl apply -f influxdb-pvc.yml.
 +
Now, let’s create the Deployment, that defines what containers we need and how:
 +
 
 +
```
 +
---
 +
apiVersion: apps/v1
 +
kind: Deployment
 +
metadata:
 +
  namespace: monitoring
 +
  labels:
 +
    app: influxdb
 +
  name: influxdb
 +
spec:
 +
  replicas: 1
 +
  selector:
 +
    matchLabels:
 +
      app: influxdb
 +
  template:
 +
    metadata:
 +
      labels:
 +
        app: influxdb
 +
    spec:
 +
      containers:
 +
      - envFrom:
 +
        - secretRef:
 +
            name: influxdb-creds
 +
        image: docker.io/influxdb:1.8
 +
        name: influxdb
 +
        volumeMounts:
 +
        - mountPath: /var/lib/influxdb
 +
          name: var-lib-influxdb
 +
      volumes:
 +
      - name: var-lib-influxdb
 +
        persistentVolumeClaim:
 +
          claimName: influxdb-pvc
 +
```

Latest revision as of 16:44, 2 June 2022

https://docs.influxdata.com/influxdb/v2.2/

Install on k8s via helm

https://artifacthub.io/packages/helm/influxdata/influxdb

Apt install and general config

https://computingforgeeks.com/install-influxdb-on-ubuntu-and-debian/





k8s

kubectl create secret generic influxdb-creds \
  --from-literal=INFLUXDB_DB=monitoring \
  --from-literal=INFLUXDB_USER=user \
  --from-literal=INFLUXDB_USER_PASSWORD=<password> \
  --from-literal=INFLUXDB_READ_USER=readonly \
  --from-literal=INFLUXDB_USER_PASSWORD=<password> \
  --from-literal=INFLUXDB_ADMIN_USER=root \
  --from-literal=INFLUXDB_ADMIN_USER_PASSWORD=<password> \
  --from-literal=INFLUXDB_HOST=influxdb  \
  --from-literal=INFLUXDB_HTTP_AUTH_ENABLED=true

Next, create some persistent storage to store the database itself:

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: monitoring
  labels:
    app: influxdb
  name: influxdb-pvc
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

If you are new to Kubernetes, the way to execute these files is to call kubectl apply -f , in our case kubectl apply -f influxdb-pvc.yml. Now, let’s create the Deployment, that defines what containers we need and how:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: monitoring
  labels:
    app: influxdb
  name: influxdb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: influxdb
  template:
    metadata:
      labels:
        app: influxdb
    spec:
      containers:
      - envFrom:
        - secretRef:
            name: influxdb-creds
        image: docker.io/influxdb:1.8
        name: influxdb
        volumeMounts:
        - mountPath: /var/lib/influxdb
          name: var-lib-influxdb
      volumes:
      - name: var-lib-influxdb
        persistentVolumeClaim:
          claimName: influxdb-pvc