Last active
February 22, 2021 03:05
-
-
Save richardjkendall/3c1fe32f448bddf18b47dffcb66aa972 to your computer and use it in GitHub Desktop.
Simple passwordless MQTT broker on kube (pv/pvc for reader...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code to deploy eclipse mosquitto in a simple, open fashion on Kube. | |
You'll need to sort out the PV/PVC. | |
kubectl apply -f configmap.yml | |
kubectl apply -f deployment.yml | |
kubectl apply -f service.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: mosquitto-config | |
data: | |
mosquitto.conf: |- | |
listener 1883 | |
allow_anonymous true | |
persistence true | |
persistence_location /mosquitto/data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mqtt | |
spec: | |
selector: | |
matchLabels: | |
app: mqtt | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: mqtt | |
spec: | |
containers: | |
- name: mqtt | |
image: eclipse-mosquitto | |
ports: | |
- containerPort: 1883 | |
volumeMounts: | |
- mountPath: /mosquitto/data | |
name: data | |
- name: mosquitto-config | |
mountPath: /mosquitto/config/mosquitto.conf | |
subPath: mosquitto.conf | |
volumes: | |
- name: data | |
persistentVolumeClaim: | |
claimName: mqtt-vol-claim | |
- name: mosquitto-config | |
configMap: | |
name: mosquitto-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mqtt-svc | |
labels: | |
app: mqtt | |
spec: | |
ports: | |
- port: 1883 | |
targetPort: 1883 | |
protocol: TCP | |
selector: | |
app: mqtt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment