feat(chart): 新增 mixingx-mqttx chart + NanoMQ 开启 WebSocket 端口
- 新增 release-charts/mixingx-mqttx:浏览器端 MQTT 客户端 (emqx/mqttx-web), Deployment + Service(ClusterIP) + Ingress(host-based),与 sso/gateway 平级, 供运维通过 Argo CD 随时部署/删除监控各 Edge 的 NanoMQ broker。 - edge-unit/nanomq.yaml:NanoMQ 容器声明 ws containerPort(8083)、Service 加 ws port, 供 MQTTX Web 等浏览器客户端经 ws 连接。Service 保持 ClusterIP, 运维需外部调试时手动改 NodePort。 - edge-unit/values.yaml:新增 mqtt.wsPort(默认 8083)。
This commit is contained in:
1 parent
f972154abf
commit
b0563138f4
7 files changed
+139
No files matched your search
@@ -31,6 +31,12 @@ spec:
|
|||||||
- name: mqtt
|
- name: mqtt
|
||||||
containerPort: {{ .Values.mqtt.port }}
|
containerPort: {{ .Values.mqtt.port }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
# WebSocket listener:emqx/nanomq 镜像默认开启 8083(路径 /mqtt)。
|
||||||
|
# 声明此 containerPort 供 MQTTX Web 等浏览器客户端通过 ws 连接。
|
||||||
|
# Service 默认 ClusterIP,运维需外部调试时手动改 NodePort。
|
||||||
|
- name: ws
|
||||||
|
containerPort: {{ .Values.mqtt.wsPort | default 8083 }}
|
||||||
|
protocol: TCP
|
||||||
resources:
|
resources:
|
||||||
{{ toYaml .Values.mqtt.resources | default dict | nindent 12 }}
|
{{ toYaml .Values.mqtt.resources | default dict | nindent 12 }}
|
||||||
---
|
---
|
||||||
@@ -54,4 +60,8 @@ spec:
|
|||||||
port: {{ .Values.mqtt.port }}
|
port: {{ .Values.mqtt.port }}
|
||||||
targetPort: mqtt
|
targetPort: mqtt
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
- name: ws
|
||||||
|
port: {{ .Values.mqtt.wsPort | default 8083 }}
|
||||||
|
targetPort: ws
|
||||||
|
protocol: TCP
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -58,5 +58,6 @@ mqtt:
|
|||||||
repository: emqx/nanomq
|
repository: emqx/nanomq
|
||||||
tag: 0.25.2-2
|
tag: 0.25.2-2
|
||||||
port: 1883
|
port: 1883
|
||||||
|
wsPort: 8083 # WebSocket listener(NanoMQ 镜像默认开启,路径 /mqtt),供 MQTTX Web 连接
|
||||||
credentialRef: "" # 默认空,模板内 default 为 {name}-mqtt
|
credentialRef: "" # 默认空,模板内 default 为 {name}-mqtt
|
||||||
resources: {}
|
resources: {}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: mixingx-mqttx
|
||||||
|
description: MixingX MQTTX Web — 浏览器端 MQTT 客户端,用于监控/调试各 Edge 的 NanoMQ broker。
|
||||||
|
type: application
|
||||||
|
version: 0.1.0
|
||||||
|
appVersion: "1.0.1"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{{/*
|
||||||
|
组件名(默认 mqttx,可被 values 覆盖)。
|
||||||
|
*/}}
|
||||||
|
{{- define "mixingx-mqttx.name" -}}
|
||||||
|
{{- .Values.mqttx.name | default "mqttx" -}}
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{{- $name := include "mixingx-mqttx.name" . }}
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}-ingress
|
||||||
|
annotations:
|
||||||
|
{{- range $k, $v := .Values.ingress.annotations }}
|
||||||
|
{{ $k }}: {{ $v | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
ingressClassName: {{ .Values.ingress.className }}
|
||||||
|
rules:
|
||||||
|
- host: {{ .Values.ingress.host }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ $name }}-service
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{{- $root := . }}
|
||||||
|
{{- $name := include "mixingx-mqttx.name" . }}
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}-deployment
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: mixingx
|
||||||
|
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||||
|
app.kubernetes.io/component: {{ $name }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.mqttx.replicas | default 1 }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/component: {{ $name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/component: {{ $name }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: {{ $name }}
|
||||||
|
image: "{{ .Values.mqttx.image.repository }}:{{ .Values.mqttx.image.tag | default "latest" }}"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 80
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: TZ
|
||||||
|
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
|
||||||
|
# emqx/mqttx-web 是纯静态 nginx 镜像,无健康端点;用 TCP 探针探 80 端口。
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 30
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}-service
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: mixingx
|
||||||
|
app.kubernetes.io/component: {{ $name }}
|
||||||
|
mixingx.io/role: mqttx
|
||||||
|
mixingx.io/node-id: {{ $name }}
|
||||||
|
annotations:
|
||||||
|
mixingx.io/description: {{ .Values.mqttx.description | quote }}
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/component: {{ $name }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# MQTTX Web: 浏览器端 MQTT 客户端 (emqx/mqttx-web, 容器内 nginx:80 纯静态 SPA)。
|
||||||
|
# 部署后通过浏览器用 WebSocket 连各 Edge 的 NanoMQ,开发/调试 MQTT 流量。
|
||||||
|
#
|
||||||
|
# 连 NanoMQ 的方式:
|
||||||
|
# NanoMQ Service 默认 ClusterIP(外部不可达),运维需把目标 Edge 的 NanoMQ Service
|
||||||
|
# 临时改成 NodePort(kubectl patch svc <edge>-nanomq-service -p '{"spec":{"type":"NodePort"}}'
|
||||||
|
# 并在 Service 上声明 ws 端口),然后在 MQTTX Web 新建连接填:
|
||||||
|
# ws://<节点IP>:<NodePort>/mqtt
|
||||||
|
#
|
||||||
|
# Ingress:demo 环境有 *.mixingx.local DNS,用 host 暴露;无 DNS 的现场改用 NodePort。
|
||||||
|
|
||||||
|
timezone: Asia/Shanghai
|
||||||
|
|
||||||
|
mqttx:
|
||||||
|
name: mqttx
|
||||||
|
replicas: 1
|
||||||
|
image:
|
||||||
|
repository: emqx/mqttx-web
|
||||||
|
tag: latest
|
||||||
|
description: "MQTT 监控客户端"
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: traefik
|
||||||
|
host: mqttx.mixingx.local
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: web
|
||||||
Reference in new issue
Block a user