diff --git a/influxdb/influx2-config.yaml b/influxdb/influx2-config.yaml new file mode 100644 index 0000000..11471e7 --- /dev/null +++ b/influxdb/influx2-config.yaml @@ -0,0 +1,14 @@ +persistence: + useExisting: true + name: influxdb2-data-influxdb2-0 + +ingress: + enabled: true + tls: true + secretName: influx2-tbrnt-ch-cert + hostname: influx2.tbrnt.ch + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + +pdb: + create: false diff --git a/influxdb/influxdb2.yaml b/influxdb/influxdb2.yaml new file mode 100644 index 0000000..7596a4b --- /dev/null +++ b/influxdb/influxdb2.yaml @@ -0,0 +1,156 @@ +--- +# Source: influxdb2/templates/secret.yaml +apiVersion: v1 +kind: Secret +metadata: + labels: + app.kubernetes.io/name: influxdb2 + helm.sh/chart: influxdb2-2.0.1 + app.kubernetes.io/instance: influxdb2 + app.kubernetes.io/version: "2.0.6" + app.kubernetes.io/managed-by: Helm + name: influxdb2-auth +data: + admin-token: "ZVRLOFJkT0VvU2hYazhhdFE2ZTVXTkI3dFd6WHFHbGk=" + admin-password: "NFdPNW5EcDdOMVdadzdNdHRWeXJLTHlESDE5dUVOdWk=" +--- +# Source: influxdb2/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: influxdb2 + labels: + app.kubernetes.io/name: influxdb2 + helm.sh/chart: influxdb2-2.0.1 + app.kubernetes.io/instance: influxdb2 + app.kubernetes.io/version: "2.0.6" + app.kubernetes.io/managed-by: Helm +spec: + type: ClusterIP + ports: + - name: http + port: 80 + protocol: TCP + targetPort: 8086 + + selector: + app.kubernetes.io/name: influxdb2 + app.kubernetes.io/instance: influxdb2 +--- +# Source: influxdb2/templates/statefulset.yaml +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: influxdb2 + labels: + + app.kubernetes.io/name: influxdb2 + helm.sh/chart: influxdb2-2.0.1 + app.kubernetes.io/instance: influxdb2 + app.kubernetes.io/version: "2.0.6" + app.kubernetes.io/managed-by: Helm +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: influxdb2 + app.kubernetes.io/instance: influxdb2 + serviceName: "influxdb2" + template: + metadata: + labels: + app.kubernetes.io/name: influxdb2 + app.kubernetes.io/instance: influxdb2 + annotations: + {} + spec: + volumes: + - name: data + persistentVolumeClaim: + claimName: influxdb2-data-influxdb2-0 + containers: + - name: influxdb2 + image: "influxdb:2.0.6-alpine" + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8086 + protocol: TCP + env: + # Automated setup will not run if an existing boltdb file is found at the configured path. + # This behavior allows for the InfluxDB container to reboot post-setup without encountering "DB is already set up" errors. + - name: DOCKER_INFLUXDB_INIT_MODE + value: setup + # The username to set for the system's initial super-user (Required). + - name: DOCKER_INFLUXDB_INIT_USERNAME + value: admin + # The password to set for the system's inital super-user (Required). + - name: DOCKER_INFLUXDB_INIT_PASSWORD + valueFrom: + secretKeyRef: + name: influxdb2-auth + key: admin-password + # The name to set for the system's initial organization (Required). + - name: DOCKER_INFLUXDB_INIT_ORG + value: influxdata + # The name to set for the system's initial bucket (Required). + - name: DOCKER_INFLUXDB_INIT_BUCKET + value: default + # The duration the system's initial bucket should retain data. If not set, the initial bucket will retain data forever. + - name: DOCKER_INFLUXDB_INIT_RETENTION + value: 0s + # The authentication token to associate with the system's initial super-user. If not set, a token will be auto-generated by the system. + - name: DOCKER_INFLUXDB_INIT_ADMIN_TOKEN + valueFrom: + secretKeyRef: + name: influxdb2-auth + key: admin-token + + # Path to the BoltDB database. + - name: INFLUXD_BOLT_PATH + value: /var/lib/influxdbv2/influxd.bolt + # Path to persistent storage engine files where InfluxDB stores all Time-Structure Merge Tree (TSM) data on disk. + - name: INFLUXD_ENGINE_PATH + value: /var/lib/influxdbv2 + + # Extra environment variables from .Values.env + livenessProbe: + httpGet: + path: /health + port: http + readinessProbe: + httpGet: + path: /health + port: http + volumeMounts: + - name: data + mountPath: /var/lib/influxdbv2 + resources: + {} +--- +# Source: influxdb2/templates/ingress.yaml +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: influxdb2 + labels: + app.kubernetes.io/name: influxdb2 + helm.sh/chart: influxdb2-2.0.1 + app.kubernetes.io/instance: influxdb2 + app.kubernetes.io/version: "2.0.6" + app.kubernetes.io/managed-by: Helm + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod +spec: + tls: + - hosts: + - "influx2.tbrnt.ch" + secretName: influx2-tbrnt-ch-cert + rules: + - host: influx2.tbrnt.ch + http: + paths: + - path: / + backend: + serviceName: influxdb2 + servicePort: http diff --git a/influxdb/pvc.yaml b/influxdb/pvc.yaml index 677ae3a..da187b3 100644 --- a/influxdb/pvc.yaml +++ b/influxdb/pvc.yaml @@ -9,3 +9,15 @@ spec: requests: storage: 8Gi storageClassName: local-path +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: influxdb2-data-influxdb2-0 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 8Gi + storageClassName: local-path