# 部署 EMQX 插件(以 emqx_prometheus
为例)
# 前置条件
- 成功部署 EMQX Operator
- 成功部署 EMQX 自定义资源
# 配置 emqx_prometheus
插件
cat << "EOF" | kubectl apply -f -
apiVersion: apps.emqx.io/v1beta3
kind: EmqxPlugin
metadata:
name: emqx-prometheus
namespace: default
spec:
selector:
"foo": "bar"
pluginName: emqx_prometheus
config:
"prometheus.push.gateway.server": "http://prometheus-pushgateway.prom.svc.cluster.local:9091"
EOF
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 检查 emqx_prometheus
是否创建成功
kubectl get emqxplugins.apps.emqx.io | grep prometheus
emqx-prometheus 2m37s
1
2
2
# 检查 EMQX 实例插件是否生效
kubectl exec -it emqx-0 -- emqx_ctl plugins list | grep prometheus
Plugin(emqx_prometheus, description=Prometheus for EMQ X, active=true)
1
2
2