Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cerebrate
Last active May 5, 2022 03:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cerebrate/08bd64a21ac27587f0f63bd4ee173f7b to your computer and use it in GitHub Desktop.
Save cerebrate/08bd64a21ac27587f0f63bd4ee173f7b to your computer and use it in GitHub Desktop.
Mosquitto config for my Kubernetes cluster
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mosquitto-configmap
labels:
app.kubernetes.io/name: mosquitto
data:
mosquitto.conf: |
listener 1883
allow_anonymous true
persistence true
persistence_location /mosquitto/data
autosave_interval 1800
---
apiVersion: v1
kind: Service
metadata:
name: mosquitto
labels:
app.kubernetes.io/name: mosquitto
spec:
type: ClusterIP
ports:
- port: 1883
targetPort: mqtt
protocol: TCP
name: mqtt
selector:
app.kubernetes.io/name: mosquitto
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mosquitto
annotations:
reloader.stakater.com/auto: "true"
labels:
app.kubernetes.io/name: mosquitto
spec:
revisionHistoryLimit: 3
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: mosquitto
template:
metadata:
labels:
app.kubernetes.io/name: mosquitto
spec:
containers:
- name: mosquitto
image: "eclipse-mosquitto:2.0.12"
imagePullPolicy: IfNotPresent
ports:
- name: mqtt
containerPort: 1883
protocol: TCP
volumeMounts:
- name: data
mountPath: /mosquitto/data
- name: mosquitto-config
mountPath: /mosquitto/config/mosquitto.conf
subPath: mosquitto.conf
livenessProbe:
tcpSocket:
port: 1883
initialDelaySeconds: 0
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 60
readinessProbe:
tcpSocket:
port: 1883
initialDelaySeconds: 0
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 60
startupProbe:
tcpSocket:
port: 1883
initialDelaySeconds: 0
failureThreshold: 30
timeoutSeconds: 1
periodSeconds: 5
volumes:
- name: data
nfs:
server: mnemosyne.arkane-systems.lan
path: "/swarm/harmony/mosquitto"
- name: mosquitto-config
configMap:
name: mosquitto-configmap
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
name: mosquitto-ingress-tcp
labels:
app.kubernetes.io/name: mosquitto
spec:
entryPoints:
- mqtt
routes:
- match: HostSNI(`*`)
services:
- name: mosquitto
kind: Service
port: 1883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment