k8s influxdb

This commit is contained in:
2025-07-23 14:29:45 +02:00
committed by swordsteel
parent 1a18ef90e4
commit bde856e378
5 changed files with 149 additions and 7 deletions

View File

@@ -19,22 +19,27 @@
* [Cassandra](#cassandra) * [Cassandra](#cassandra)
* [Stateful Set](#stateful-set-1) * [Stateful Set](#stateful-set-1)
* [Service](#service-1) * [Service](#service-1)
* [Hlæja](#hlæja) * [InfluxDb](#influxdb)
* [Account Register](#account-register)
* [Secret](#secret-1) * [Secret](#secret-1)
* [Config Map](#config-map-1) * [Config Map](#config-map-1)
* [Deployment](#deployment) * [Stateful Set](#stateful-set-2)
* [Service](#service-2) * [Service](#service-2)
* [Device Register](#device-register) * [Hlæja](#hlæja)
* [Account Register](#account-register)
* [Secret](#secret-2) * [Secret](#secret-2)
* [Config Map](#config-map-2) * [Config Map](#config-map-2)
* [Deployment](#deployment-1) * [Deployment](#deployment)
* [Service](#service-3) * [Service](#service-3)
* [Device Configuration](#device-configuration) * [Device Register](#device-register)
* [Secret](#secret-3) * [Secret](#secret-3)
* [Config Map](#config-map-3) * [Config Map](#config-map-3)
* [Deployment](#deployment-2) * [Deployment](#deployment-1)
* [Service](#service-4) * [Service](#service-4)
* [Device Configuration](#device-configuration)
* [Secret](#secret-4)
* [Config Map](#config-map-4)
* [Deployment](#deployment-2)
* [Service](#service-5)
<!-- TOC --> <!-- TOC -->
---- ----
@@ -226,6 +231,54 @@ kubectl apply -f .\kube\02-databases\02-cassandra\02-service.yaml
--- ---
### InfluxDb
#### Secret
```bash
kubectl apply -f .\kube\02-databases\03-influxdb\01-secret.yaml
```
Set values:
- influx root password
- influx token
using something a bit more secure `SCRAM-SHA-256$4096:f/IWlCTGdMT9qOjQlPbWtA==$qePy5ArW+7ykg3yHqW7qYH0j2384OIoV2IcBcz0mIRM=:KuU1xgnAVtOVpCZhdUJlI8F7Viz0ApmYxYEo5yXNCW0=` in this case we use `password`, to make this... use postgres to make a user and password, copy this value and now will use as admin password.
#### Config Map
```bash
kubectl apply -f .\kube\02-databases\03-influxdb\02-configmap.yaml
```
Set values:
- influx root username
- influx mode
- influx organisation
- influx bucket
#### Stateful Set
This is the specifications for influxdb.
```bash
kubectl apply -f .\kube\02-databases\03-infulxdb\03-statefulset.yaml
```
Set storage size for permanent storage
#### Service
this exposes port and ip.
```bash
kubectl apply -f .\kube\02-databases\03-infulxdb\04-service.yaml
```
---
## Hlæja ## Hlæja
To access service use `kubectl exec -it <pod-name> -n hlaeja -- /bin/sh` To access service use `kubectl exec -it <pod-name> -n hlaeja -- /bin/sh`

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
name: influxdb
namespace: hlaeja
labels:
app: influxdb
environment: testing
tier: database
type: Opaque
stringData:
DOCKER_INFLUXDB_INIT_PASSWORD: "password"
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: "influxdbToken=="

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: influxdb
namespace: hlaeja
labels:
app: influxdb
environment: testing
tier: database
data:
DOCKER_INFLUXDB_INIT_MODE: "setup"
DOCKER_INFLUXDB_INIT_USERNAME: "influx"
DOCKER_INFLUXDB_INIT_ORG: "hlaeja_ltd"
DOCKER_INFLUXDB_INIT_BUCKET: "device-data"

View File

@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: influxdb
namespace: hlaeja
labels:
app: influxdb
environment: testing
tier: database
spec:
serviceName: influxdb
replicas: 1
selector:
matchLabels:
app: influxdb
template:
metadata:
labels:
app: influxdb
spec:
containers:
- name: influxdb
image: influxdb:2.7.12
ports:
- containerPort: 8086
envFrom:
- configMapRef:
name: influxdb
- secretRef:
name: influxdb
volumeMounts:
- name: influxdb-data
mountPath: /var/lib/influxdb2
volumeClaimTemplates:
- metadata:
name: influxdb-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi

View File

@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: influxdb
namespace: hlaeja
labels:
app: influxdb
environment: testing
tier: database
annotations:
metallb.universe.tf/address-pool: default
spec:
type: LoadBalancer
loadBalancerIP: 10.0.3.143
selector:
app: influxdb
ports:
- port: 80
targetPort: 8086
protocol: TCP
name: influxdb