me own pihole

This commit is contained in:
2020-07-23 17:18:21 +02:00
parent 74b727b62b
commit 1c51a6604b
39 changed files with 2769 additions and 30 deletions

View File

@@ -0,0 +1,146 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mosquitto
release: mqtt
name: mqtt-mosquitto
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: mosquitto
release: mqtt
strategy:
type: Recreate
template:
metadata:
labels:
app: mosquitto
release: mqtt
spec:
containers:
- name: mosquitto-exporter
image: docker-registry.lan/mosquitto-exporter:arm64
imagePullPolicy: Always
ports:
- containerPort: 9234
name: mqtt-exporter
protocol: TCP
- name: mqtt-mosquitto
image: eclipse-mosquitto:latest
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 1
successThreshold: 1
tcpSocket:
port: 9090
timeoutSeconds: 1
ports:
- containerPort: 1883
name: mqtt
protocol: TCP
- containerPort: 9090
name: websocket
protocol: TCP
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 3
periodSeconds: 3
successThreshold: 1
tcpSocket:
port: 9090
timeoutSeconds: 1
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 50m
memory: 100Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /mosquitto/config/mosquitto.conf
name: mosquitto-conf
readOnly: true
subPath: mosquitto.conf
- mountPath: /mosquitto/data
name: mosquitto-data
subPath: mosquitto/data
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: mqtt-mosquitto
name: mosquitto-conf
- name: mosquitto-data
persistentVolumeClaim:
claimName: mqtt-mosquitto
---
apiVersion: v1
kind: Service
metadata:
labels:
app: mosquitto
release: mqtt
namespace: default
name: mqtt-mosquitto
spec:
externalTrafficPolicy: Cluster
loadBalancerIP: 172.23.255.3
ports:
- name: mqtt
port: 1883
protocol: TCP
targetPort: 1883
- name: mqtt-exporter
port: 9234
protocol: TCP
targetPort: 9234
selector:
app: mosquitto
type: LoadBalancer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/storage-provisioner: nfs-storage
labels:
app: mosquitto
release: mqtt
name: mqtt-mosquitto
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: managed-nfs-storage
volumeMode: Filesystem
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mqtt-mosquitto
namespace: default
labels:
app: mosquitto
release: mqtt
data:
mosquitto.conf: |-
log_dest stdout
listener 1883
listener 9090
protocol websockets

218
apps/pihole-deployment.yaml Normal file
View File

@@ -0,0 +1,218 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: pihole
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: pihole
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
annotations:
labels:
app: pihole
spec:
containers:
- env:
- name: WEB_PORT
value: "80"
- name: VIRTUAL_HOST
value: pihole.lan
- name: WEBPASSWORD
valueFrom:
secretKeyRef:
key: password
name: pihole-password
- name: DNS1
value: 208.67.222.222
- name: DNS2
value: 208.67.220.220
image: pihole/pihole:v5.1.1
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 10
httpGet:
path: /admin.index.php
port: http
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: pihole
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 53
name: dns
protocol: TCP
- containerPort: 53
name: dns-udp
protocol: UDP
- containerPort: 443
name: https
protocol: TCP
- containerPort: 67
name: client-udp
protocol: UDP
readinessProbe:
failureThreshold: 3
httpGet:
path: /admin.index.php
port: http
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 50m
memory: 100Mi
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/pihole
name: config
- mountPath: /etc/dnsmasq.d/02-custom.conf
name: custom-dnsmasq
subPath: 02-custom.conf
- mountPath: /etc/addn-hosts
name: custom-dnsmasq
subPath: addn-hosts
#dnsConfig:
# nameservers:
# - 127.0.0.1
# - 192.168.10.1
dnsPolicy: None
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: config
persistentVolumeClaim:
claimName: pihole-data
- configMap:
defaultMode: 420
name: pihole-custom-dnsmasq
name: custom-dnsmasq
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: pihole
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /admin/$1
spec:
rules:
- host: pihole.lan
http:
paths:
- backend:
serviceName: pihole-tcp
servicePort: http
path: /(.*)
pathType: ImplementationSpecific
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pihole-data
annotations:
volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
spec:
storageClassName: csi-s3-slow
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
data:
02-custom.conf: |
address=/chaos/192.168.10.1
kind: ConfigMap
metadata:
creationTimestamp: null
name: pihole-custom-dnsmasq
---
apiVersion: v1
kind: Service
metadata:
annotations:
kube-router.io/service.scheduler: sh
metallb.universe.tf/address-pool: default
metallb.universe.tf/allow-shared-ip: pihole-svc
labels:
app: pihole
name: pihole-tcp
namespace: default
spec:
externalTrafficPolicy: Cluster
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
- name: https
port: 443
protocol: TCP
targetPort: 80
- name: dns
port: 53
protocol: TCP
targetPort: 53
selector:
app: pihole
sessionAffinity: None
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
annotations:
kube-router.io/service.scheduler: sh
metallb.universe.tf/address-pool: default
metallb.universe.tf/allow-shared-ip: pihole-svc
labels:
app: pihole
name: pihole-udp
namespace: default
spec:
externalTrafficPolicy: Cluster
ports:
- name: dns-udp
port: 53
protocol: UDP
targetPort: 53
- name: client-udp
port: 67
protocol: UDP
targetPort: 67
selector:
app: pihole
sessionAffinity: None
type: LoadBalancer
---