Merge pull request #337 from michaelpietzsch/master

Adding K8S Deployment Templates
This commit is contained in:
David Newhall 2021-04-11 11:58:29 -07:00 committed by GitHub
commit a3d425c6df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 232 additions and 0 deletions

145
examples/k8s/influx.yml Normal file
View File

@ -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:1.8
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
---

5
examples/k8s/readme.md Normal file
View File

@ -0,0 +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.

View File

@ -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