restructure mosquitto and enable persistence
This commit is contained in:
parent
494407000e
commit
7e27022d2c
12
mosquitto/certificate.yaml
Normal file
12
mosquitto/certificate.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
apiVersion: cert-manager.io/v1alpha2
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: mosquitto-tls
|
||||||
|
namespace: mosquitto
|
||||||
|
spec:
|
||||||
|
dnsNames:
|
||||||
|
- mqtt.tbrnt.ch
|
||||||
|
issuerRef:
|
||||||
|
kind: ClusterIssuer
|
||||||
|
name: letsencrypt-prod
|
||||||
|
secretName: mosquitto-tls
|
|
@ -1,108 +1,3 @@
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: mosquitto
|
|
||||||
namespace: mosquitto
|
|
||||||
labels:
|
|
||||||
app: mosquitto
|
|
||||||
annotations:
|
|
||||||
secret.reloader.stakater.com/reload: "mosquitto-tls"
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: mosquitto
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: mosquitto
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mosquitto
|
|
||||||
image: docker.io/eclipse-mosquitto:1.6
|
|
||||||
imagePullPolicy: Always
|
|
||||||
ports:
|
|
||||||
- containerPort: 1883
|
|
||||||
name: mqtt
|
|
||||||
protocol: TCP
|
|
||||||
- containerPort: 8883
|
|
||||||
name: mqtts
|
|
||||||
protocol: TCP
|
|
||||||
- containerPort: 9002
|
|
||||||
name: mqttwebsocket
|
|
||||||
protocol: TCP
|
|
||||||
volumeMounts:
|
|
||||||
- mountPath: /mosquitto/config
|
|
||||||
name: config
|
|
||||||
- mountPath: /mosquitto/certificates
|
|
||||||
name: certificates
|
|
||||||
- mountPath: /mosquitto/acl
|
|
||||||
name: acl
|
|
||||||
- mountPath: /mosquitto/passwd
|
|
||||||
name: passwd
|
|
||||||
livenessProbe:
|
|
||||||
failureThreshold: 3
|
|
||||||
initialDelaySeconds: 1
|
|
||||||
periodSeconds: 10
|
|
||||||
successThreshold: 1
|
|
||||||
tcpSocket:
|
|
||||||
port: 9002
|
|
||||||
timeoutSeconds: 1
|
|
||||||
readinessProbe:
|
|
||||||
failureThreshold: 3
|
|
||||||
initialDelaySeconds: 1
|
|
||||||
periodSeconds: 10
|
|
||||||
successThreshold: 1
|
|
||||||
tcpSocket:
|
|
||||||
port: 9002
|
|
||||||
timeoutSeconds: 1
|
|
||||||
volumes:
|
|
||||||
- name: config
|
|
||||||
configMap:
|
|
||||||
name: mosquitto
|
|
||||||
- name: certificates
|
|
||||||
secret:
|
|
||||||
secretName: mosquitto-tls
|
|
||||||
- name: acl
|
|
||||||
secret:
|
|
||||||
secretName: mosquitto-acl
|
|
||||||
- name: passwd
|
|
||||||
secret:
|
|
||||||
secretName: mosquitto-passwd
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: mqtt-tls
|
|
||||||
namespace: mosquitto
|
|
||||||
labels:
|
|
||||||
app: mosquitto
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 8883
|
|
||||||
protocol: TCP
|
|
||||||
targetPort: mqtts
|
|
||||||
name: mqtts
|
|
||||||
selector:
|
|
||||||
app: mosquitto
|
|
||||||
type: LoadBalancer
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: mqtt-plain
|
|
||||||
namespace: mosquitto
|
|
||||||
labels:
|
|
||||||
app: mosquitto
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 1883
|
|
||||||
protocol: TCP
|
|
||||||
targetPort: mqtt
|
|
||||||
selector:
|
|
||||||
app: mosquitto
|
|
||||||
type: ClusterIP
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -121,12 +16,12 @@ data:
|
||||||
allow_zero_length_clientid true
|
allow_zero_length_clientid true
|
||||||
persistent_client_expiration 3m
|
persistent_client_expiration 3m
|
||||||
allow_duplicate_messages false
|
allow_duplicate_messages false
|
||||||
autosave_interval 60
|
|
||||||
autosave_on_changes false
|
|
||||||
|
|
||||||
# Persistence configuration
|
# Persistence configuration
|
||||||
persistence false
|
persistence true
|
||||||
# persistence_location /mosquitto/data/
|
persistence_location /mosquitto/data/
|
||||||
|
autosave_interval 60
|
||||||
|
autosave_on_changes false
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
connection_messages true
|
connection_messages true
|
||||||
|
@ -187,16 +82,3 @@ data:
|
||||||
PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6
|
PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6
|
||||||
KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==
|
KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
---
|
|
||||||
apiVersion: cert-manager.io/v1alpha2
|
|
||||||
kind: Certificate
|
|
||||||
metadata:
|
|
||||||
name: mosquitto-tls
|
|
||||||
namespace: mosquitto
|
|
||||||
spec:
|
|
||||||
dnsNames:
|
|
||||||
- mqtt.tbrnt.ch
|
|
||||||
issuerRef:
|
|
||||||
kind: ClusterIssuer
|
|
||||||
name: letsencrypt-prod
|
|
||||||
secretName: mosquitto-tls
|
|
76
mosquitto/deployment.yaml
Normal file
76
mosquitto/deployment.yaml
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: mosquitto
|
||||||
|
namespace: mosquitto
|
||||||
|
labels:
|
||||||
|
app: mosquitto
|
||||||
|
annotations:
|
||||||
|
secret.reloader.stakater.com/reload: "mosquitto-tls"
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mosquitto
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mosquitto
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: mosquitto
|
||||||
|
image: docker.io/eclipse-mosquitto:1.6
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 1883
|
||||||
|
name: mqtt
|
||||||
|
protocol: TCP
|
||||||
|
- containerPort: 8883
|
||||||
|
name: mqtts
|
||||||
|
protocol: TCP
|
||||||
|
- containerPort: 9002
|
||||||
|
name: mqttwebsocket
|
||||||
|
protocol: TCP
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /mosquitto/config
|
||||||
|
name: config
|
||||||
|
- mountPath: /mosquitto/certificates
|
||||||
|
name: certificates
|
||||||
|
- mountPath: /mosquitto/acl
|
||||||
|
name: acl
|
||||||
|
- mountPath: /mosquitto/passwd
|
||||||
|
name: passwd
|
||||||
|
- mountPath: /mosquitto/data
|
||||||
|
name: data
|
||||||
|
livenessProbe:
|
||||||
|
failureThreshold: 3
|
||||||
|
initialDelaySeconds: 1
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
tcpSocket:
|
||||||
|
port: 9002
|
||||||
|
timeoutSeconds: 1
|
||||||
|
readinessProbe:
|
||||||
|
failureThreshold: 3
|
||||||
|
initialDelaySeconds: 1
|
||||||
|
periodSeconds: 10
|
||||||
|
successThreshold: 1
|
||||||
|
tcpSocket:
|
||||||
|
port: 9002
|
||||||
|
timeoutSeconds: 1
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mosquitto
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: mosquitto
|
||||||
|
- name: certificates
|
||||||
|
secret:
|
||||||
|
secretName: mosquitto-tls
|
||||||
|
- name: acl
|
||||||
|
secret:
|
||||||
|
secretName: mosquitto-acl
|
||||||
|
- name: passwd
|
||||||
|
secret:
|
||||||
|
secretName: mosquitto-passwd
|
11
mosquitto/pvc.yaml
Normal file
11
mosquitto/pvc.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mosquitto
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
|
storageClassName: local-path
|
32
mosquitto/service.yaml
Normal file
32
mosquitto/service.yaml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mqtt-tls
|
||||||
|
namespace: mosquitto
|
||||||
|
labels:
|
||||||
|
app: mosquitto
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 8883
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: mqtts
|
||||||
|
name: mqtts
|
||||||
|
selector:
|
||||||
|
app: mosquitto
|
||||||
|
type: LoadBalancer
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mqtt-plain
|
||||||
|
namespace: mosquitto
|
||||||
|
labels:
|
||||||
|
app: mosquitto
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 1883
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: mqtt
|
||||||
|
selector:
|
||||||
|
app: mosquitto
|
||||||
|
type: ClusterIP
|
Reference in a new issue