apiVersion: v1
kind: Namespace
metadata:
  name: db-emqx
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: emqx
  namespace: db-emqx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: emqx
  template:
    metadata:
      labels:
        app: emqx
    spec:
      containers:
        - name: emqx
          image: hub.yizhisec.com/external/emqx:5.1
          ports:
            - containerPort: 1883
              name: mqtt
            - containerPort: 8883
              name: mqtt-ssl
            - containerPort: 18083
              name: dashboard
            - containerPort: 18084
              name: websocket
          env:
            - name: EMQX_NODE_NAME
              value: "emqx@single-node"
            - name: EMQX_DASHBOARD__DEFAULT_PASSWORD
              value: "YizhiSEC@123"

---
apiVersion: v1
kind: Service
metadata:
  name: emqx-service
  namespace: db-emqx
spec:
  selector:
    app: emqx
  type: ClusterIP
  ports:
    - name: mqtt
      port: 1883
      targetPort: 1883
    - name: mqtt-ssl
      port: 8883
      targetPort: 8883
    - name: dashboard
      port: 18083
      targetPort: 18083
    - name: websocket
      port: 18084
      targetPort: 18084

