diff --git a/doc/k8s-testing.md b/doc/k8s-testing.md index e81855b..efe8769 100644 --- a/doc/k8s-testing.md +++ b/doc/k8s-testing.md @@ -19,22 +19,27 @@ * [Cassandra](#cassandra) * [Stateful Set](#stateful-set-1) * [Service](#service-1) - * [Hlæja](#hlæja) - * [Account Register](#account-register) + * [InfluxDb](#influxdb) * [Secret](#secret-1) * [Config Map](#config-map-1) - * [Deployment](#deployment) + * [Stateful Set](#stateful-set-2) * [Service](#service-2) - * [Device Register](#device-register) + * [Hlæja](#hlæja) + * [Account Register](#account-register) * [Secret](#secret-2) * [Config Map](#config-map-2) - * [Deployment](#deployment-1) + * [Deployment](#deployment) * [Service](#service-3) - * [Device Configuration](#device-configuration) + * [Device Register](#device-register) * [Secret](#secret-3) * [Config Map](#config-map-3) - * [Deployment](#deployment-2) + * [Deployment](#deployment-1) * [Service](#service-4) + * [Device Configuration](#device-configuration) + * [Secret](#secret-4) + * [Config Map](#config-map-4) + * [Deployment](#deployment-2) + * [Service](#service-5) ---- @@ -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 To access service use `kubectl exec -it -n hlaeja -- /bin/sh` diff --git a/kube/02-databases/03-influxdb/01-secret.yaml b/kube/02-databases/03-influxdb/01-secret.yaml new file mode 100644 index 0000000..c594feb --- /dev/null +++ b/kube/02-databases/03-influxdb/01-secret.yaml @@ -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==" diff --git a/kube/02-databases/03-influxdb/02-configmap.yaml b/kube/02-databases/03-influxdb/02-configmap.yaml new file mode 100644 index 0000000..1c3ce85 --- /dev/null +++ b/kube/02-databases/03-influxdb/02-configmap.yaml @@ -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" diff --git a/kube/02-databases/03-influxdb/03-statefulset.yaml b/kube/02-databases/03-influxdb/03-statefulset.yaml new file mode 100644 index 0000000..f8a8901 --- /dev/null +++ b/kube/02-databases/03-influxdb/03-statefulset.yaml @@ -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 diff --git a/kube/02-databases/03-influxdb/04-service.yaml b/kube/02-databases/03-influxdb/04-service.yaml new file mode 100644 index 0000000..33a2ded --- /dev/null +++ b/kube/02-databases/03-influxdb/04-service.yaml @@ -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