apiVersion: apps/v1
kind: Deployment
metadata:
  name: mosquitto
  namespace: home
  labels:
    app.kubernetes.io/name: mosquitto
    app.kubernetes.io/part-of: mosquitto
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: mosquitto
  replicas: 1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mosquitto
    spec:
      containers:
        - name: mosquitto
          image: eclipse-mosquitto:2.0.14
          imagePullPolicy: IfNotPresent
          ports:
            - name: mqtt
              containerPort: 1883
              protocol: TCP
            - name: mqtts
              containerPort: 8883
              protocol: TCP
          resources:
            requests:
              memory: "64Mi"
              cpu: "100m"
            limits:
              memory: "128Mi"
              cpu: "250m"
          volumeMounts:
            - mountPath: /mosquitto/config
              name: configuration
            - mountPath: /home/mosquitto
              name: passwd
      volumes:
        - name: configuration
          configMap:
            name: mosquitto-config
            items:
              - key: mosquitto.conf
                path: mosquitto.conf
        - name: passwd
          secret:
            secretName: mosquitto-passwd