apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mosquitto
spec:
  serviceName: mosquitto
  replicas: 1
  selector:
    matchLabels:
      app: mosquitto
  template:
    metadata:
      labels:
        app: mosquitto
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        - image: eclipse-mosquitto:1.6.12
          name: mosquitto
          ports:
            - containerPort: 1883
              name: default
              protocol: TCP
            - containerPort: 9001
              name: websocket
              protocol: TCP
          volumeMounts:
            - name: mosquitto-configs
              mountPath: /mosquitto/config/mosquitto.conf
              subPath: mosquitto.conf
      volumes:
        - name: mosquitto-configs
          configMap:
            name: mosquitto-configs
