一、官方文档、docker安装
二、原始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)访问
admin/public
目录:https://blog.csdn.net/u013595395/article/details/114527658