From 742dfdcb3ca126bbdd754f2fb3366643648500ec Mon Sep 17 00:00:00 2001 From: Michaelpietzsch Date: Fri, 9 Apr 2021 23:28:55 +0200 Subject: [PATCH 1/3] Adding K8S Content --- examples/k8s/influx.yml | 145 +++++++++++++++++++++++++++++++++ examples/k8s/readme.md | 3 + examples/k8s/unifi_poller.yaml | 82 +++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 examples/k8s/influx.yml create mode 100644 examples/k8s/readme.md create mode 100644 examples/k8s/unifi_poller.yaml diff --git a/examples/k8s/influx.yml b/examples/k8s/influx.yml new file mode 100644 index 00000000..7be32abc --- /dev/null +++ b/examples/k8s/influx.yml @@ -0,0 +1,145 @@ +#Create InfluxDB +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: influx + namespace: monitoring + labels: + app: unifi-poller + type: influx +spec: + replicas: 1 + selector: + matchLabels: + app: unifi-poller + type: influx + template: + metadata: + labels: + app: unifi-poller + type: influx + spec: + containers: + - name: influxdb + image: influxdb:latest + ports: + - containerPort: 8086 + env: +#Fill with own settings + - name: INFLUXDB_DB + value: maindb + - name: INFLUXDB_HTTP_AUTH_ENABLED + value: 'false' + - name: INFLUXDB_ADMIN_USER + value: XXXXXXX + - name: INFLUXDB_ADMIN_PASSWORD + value: XXXX + volumeMounts: + - name: influx-volume + mountPath: /var/lib/influxdb + volumes: + - name: influx-volume + persistentVolumeClaim: + claimName: influx-volume-claim + + + +# Persisten Volume Example +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: influx-volume-claim + namespace: monitoring +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: influx + namespace: monitoring +spec: + selector: + app: unifi-poller + type: influx + ports: + - protocol: TCP + port: 8086 + targetPort: 8086 + +--- +#Create Chronograf +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: chronograf + namespace: monitoring + labels: + app: unifi-poller + type: chronograf +spec: + replicas: 1 + selector: + matchLabels: + app: unifi-poller + type: chronograf + template: + metadata: + labels: + app: unifi-poller + type: chronograf + spec: + containers: + - name: chronograf + image: chronograf:latest + ports: + - containerPort: 8888 + env: +## Fill in with Own settings + - name: INFLUXDB_URL + value: http://influx.monitoring.svc.cluster.local:8086 + - name: INFLUXDB_USERNAME + value: xxxxx + - name: INFLUXDB_PASSWORD + value: xxxxx +# volumeMounts: +# - name: chronograf-volume +# mountPath: /var/lib/chronograf +# volumes: +# - name: chronograf-volume +# persistentVolumeClaim: +# claimName: chronograf-volume-claim +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: chronograf-volume-claim + namespace: monitoring +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: chronograf + namespace: monitoring +spec: + selector: + app: unifi-poller + type: chronograf + ports: + - protocol: TCP + port: 8888 + targetPort: 8888 +--- \ No newline at end of file diff --git a/examples/k8s/readme.md b/examples/k8s/readme.md new file mode 100644 index 00000000..4babe86f --- /dev/null +++ b/examples/k8s/readme.md @@ -0,0 +1,3 @@ +# Kubernetes Template +The following files are Kubernetes deployment examples. Feel free to use them as you see fit. + diff --git a/examples/k8s/unifi_poller.yaml b/examples/k8s/unifi_poller.yaml new file mode 100644 index 00000000..48304fe2 --- /dev/null +++ b/examples/k8s/unifi_poller.yaml @@ -0,0 +1,82 @@ +#Create Unifi Poller +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: unifi-poller + namespace: monitoring + labels: + app: unifi-poller + type: poller +spec: + replicas: 1 + selector: + matchLabels: + app: unifi-poller + type: poller + template: + metadata: + labels: + app: unifi-poller + type: poller + annotations: + prometheus.io/path: /metrics + prometheus.io/port: "9130" + prometheus.io/scrape: "true" + spec: + containers: + - name: unifi-poller + image: golift/unifi-poller:latest + ports: + - containerPort: 9130 + name: tcp + protocol: TCP + - containerPort: 9130 + name: udp + protocol: UDP + volumeMounts: + - name: config-volume + mountPath: /config/unifi-poller.conf + subPath: unifi-poller.conf + volumes: + - name: config-volume + configMap: + name: unifi-poller + + +# Add Config Map for Unifi Poller +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: unifi-poller + namespace: monitoring + labels: + app: unifi-poller + type: poller +data: + unifi-poller.conf: | + [poller] + debug = false + quiet = false + plugins = [] + [prometheus] + disable = false + http_listen = "0.0.0.0:9130" + report_errors = false + [unifi] + dynamic = false + [loki] +#Point to your own Loki service + url = "http://loki.monitoring.svc.cluster.local:3100" + [[unifi.controller]] +#Change to your own URL + url = "https://xx.xx.xx.xx" + user = "xxx" + pass = "xxx" + sites = ["all"] + save_ids = true + save_dpi = true + save_sites = true + hash_pii = false + verify_ssl = false From 717db3d84de15fee945e4b30f832cfe328fd395c Mon Sep 17 00:00:00 2001 From: Michaelpietzsch Date: Sun, 11 Apr 2021 14:25:18 +0200 Subject: [PATCH 2/3] Adding Proper Influx Version --- examples/k8s/influx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/k8s/influx.yml b/examples/k8s/influx.yml index 7be32abc..8d5c7d8f 100644 --- a/examples/k8s/influx.yml +++ b/examples/k8s/influx.yml @@ -22,7 +22,7 @@ spec: spec: containers: - name: influxdb - image: influxdb:latest + image: influxdb:1.8 ports: - containerPort: 8086 env: From c6fc4bf6983c87dcfbe574bd2a9f8db321f2b606 Mon Sep 17 00:00:00 2001 From: Michaelpietzsch Date: Sun, 11 Apr 2021 14:26:41 +0200 Subject: [PATCH 3/3] Adding Info to comments --- examples/k8s/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/k8s/readme.md b/examples/k8s/readme.md index 4babe86f..0f3e4ce2 100644 --- a/examples/k8s/readme.md +++ b/examples/k8s/readme.md @@ -1,3 +1,5 @@ # Kubernetes Template The following files are Kubernetes deployment examples. Feel free to use them as you see fit. +# Comments +Please make sure to the delete all comments before deploying and make sure to fill in with your according values. \ No newline at end of file