k8s 安装emqttx

一、官方文档、docker安装

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

 

 

二、原始k8s安装

(1)创建命名空间

kubectl create namespace a-env

(2)新建文件 vi a-env-emq.yml

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

# 复制以下内容

---
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)应用配置文件

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

(4)访问

http://192.168.15.135:18083

admin/public

 

 

目录:https://blog.csdn.net/u013595395/article/details/114527658

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值