apiVersion: apps/v1
kind: Deployment
metadata:
  name: mosquitto
  labels:
    app: mosquitto
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mosquitto
  template:
    metadata:
      labels:
        app: mosquitto
    spec:
      containers:
        - name: mosquitto
          image: eclipse-mosquitto:1.6.2
          ports:
            - containerPort: 1883
          volumeMounts: # mount volumes in the pod inside the container
            - name: mosquitto-config
              mountPath: /mosquitto/config # the path in the container where the file is at
            - name: mosquitto-secret
              mountPath: /mosquitto/secret
              readOnly: true
      volumes: # mount volumes to the pod
        - name: mosquitto-config
          configMap:
            name: mosquitto-config-file 
        - name: mosquitto-secret
          secret:
            secretName: mousquitto-secret-file
