k8s install emqttx

One, official documents, docker installation

https://docs.emqx.cn/broker/latest/getting-started/install.html#%E9%80%9A%E8%BF%87-docker-%E8%BF%90%E8%A1%8C-%E5%8C%85%E5%90%AB%E7%AE%80%E5%8D%95%E7%9A%84-docker-compose-%E9%9B%86%E7%BE%A4

 

 

Second, the original k8s installation

(1) Create a namespace

kubectl create namespace a-env

(2) Create a new file vi a-env-emq.yml

# emq: 4.2.7  https://wws.lanzous.com/iVHEMmiivuj

# Copy the following

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: emq
  namespace: a-env
spec:
  selector:
    matchLabels:
      app: emq
  replicas: 1
  template:
    metadata:
      labels:
        app: emq
    spec:
      # 限定为master节点
      # nodeName: master
      containers:
        - name: emq
          # image: emqx/emqx:4.2.7
          image: emq:4.2.7  # 自定义镜像,只改了时区
          imagePullPolicy: IfNotPresent
          ports:
            # 网页ui
            - name: dashbord
              containerPort: 18083
              protocol: TCP
            # mqtt协议端口
            - name: mqtt
              containerPort: 1883
              protocol: TCP
            # mqtt/ssl端口
            - name: mqttssl
              containerPort: 8883
              protocol: TCP
            # mqtt/websocket端口
            - name: websocket
              containerPort: 8083
              protocol: TCP
            # http api端口
            - containerPort: 8080
              protocol: TCP
          # env:
            # - name: TZ
              # value: Asia/Shanghai
          # volumeMounts:
            # - name: localtime
              # mountPath: /etc/localtime
            # - name: timezone
              # mountPath: /etc/timezone
      restartPolicy: Always
      # volumes:
        # - name: localtime
          # hostPath: 
            # path: /a_soft/k8s/env/localtime
            # type: File
        # - name: timezone
          # hostPath: 
            # path: /a_soft/k8s/env/timezone
            # type: File

---
apiVersion: v1
kind: Service
metadata:
  name: emq
  namespace: a-env
spec:
  selector:
    app: emq
  ports:
    - name: dashbord
      targetPort: dashbord
      protocol: TCP
      port: 18083
      nodePort: 18083
    - name: mqtt
      targetPort: mqtt
      protocol: TCP
      port: 1883
      nodePort: 1883
    # - name: mqttssl
      # targetPort: mqttssl
      # protocol: TCP
      # port: 8883
      # nodePort: 8883
    - name: websocket
      targetPort: websocket
      protocol: TCP
      port: 8083
      nodePort: 8083
  type: NodePort

(3) Application configuration file

kubectl apply -f ./a-svc-emq.yml

(4) Visit

http://192.168.15.135:18083

admin/public

 

 

Catalog: https://blog.csdn.net/u013595395/article/details/114527658

Guess you like

Origin blog.csdn.net/u013595395/article/details/114603477