apiVersion: apps.emqx.io/v2alpha1
kind: EMQX
metadata:name: emqx
spec:image: emqx:5.0coreTemplate:spec:ports:# prometheus monitor requires the pod must name the target port-name: dashboard
containerPort:18083replicantTemplate:spec:ports:-name: dashboard
containerPort:18083
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
将上述内容保存为:emqx.yaml,并执行如下命令部署 EMQX 集群:
$ kubectl apply -f emqx.yaml
emqx.apps.emqx.io/emqx created
1 2 3
检查 EMQX 集群状态,请确保 STATUS 为 Running,这可能需要一些时间等待 EMQX 集群准备就绪。
$ kubectl get emqx emqx
NAME IMAGE STATUS AGE
emqx emqx:5.0 Running 10m
apiVersion: apps.emqx.io/v1beta4
kind: EmqxEnterprise
metadata:name: emqx-ee
spec:template:spec:emqxContainer:image:repository: emqx/emqx-ee
version: 4.4.16
ports:# prometheus monitor requires the pod must name the target port-name: dashboard
containerPort:18083
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
将上述内容保存为:emqx.yaml,执行如下命令部署 EMQX 集群:
$ kubectl apply -f emqx.yaml
emqxenterprise.apps.emqx.io/emqx-ee created
1 2 3
检查 EMQX 集群状态,请确保 STATUS 为 Running,这可能需要一些时间等待 EMQX 集群准备就绪。
$ kubectl get emqxenterprises
NAME STATUS AGE
emqx-ee Running 8m33s
The emqx-exporter is designed to expose partial metrics that are not included in the EMQX Prometheus API. It is compatible with EMQX 4.4 and EMQX 5, both open-source and enterprise.
apiVersion: v1
kind: Service
metadata:labels:app: emqx-exporter
name: emqx-exporter-service
spec:ports:-name: metrics
port:8085targetPort: metrics
selector:app: emqx-exporter
---apiVersion: apps/v1
kind: Deployment
metadata:name: emqx-exporter
labels:app: emqx-exporter
spec:selector:matchLabels:app: emqx-exporter
replicas:1template:metadata:labels:app: emqx-exporter
spec:securityContext:runAsUser:1000containers:-name: exporter
image: emqx-exporter:latest
imagePullPolicy: IfNotPresent
args:# "emqx-dashboard-service-name" is the service name that creating by operator for exposing 18083 port---emqx.nodes=${emqx-dashboard-service-name}:18083---emqx.auth-username=${paste_your_new_api_key_here}---emqx.auth-password=${paste_your_new_secret_here}securityContext:allowPrivilegeEscalation:falserunAsNonRoot:trueports:-containerPort:8085name: metrics
protocol: TCP
resources:limits:cpu: 100m
memory: 100Mi
requests:cpu: 100m
memory: 20Mi