EMQX
ℹ️ Info:
使用 EMQX
通过 Helm3 在 Kubernetes 上部署 EMQX 4.0 集群 | EMQ
emqx/deploy/charts/emqx at main-v4.4 · emqx/emqx (github.com)
emqx/values.yaml at main-v4.4 · emqx/emqx (github.com)
emqx/emqx-operator: A Kubernetes Operator for EMQ X Broker (github.com)
EMQX 安装
ℹ️ Info:
即 EMQX 服务器端。
> helm repo add emqx https://repos.emqx.io/charts
"emqx" has been added to your repositories
> helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "emqx" chart repository
Update Complete. ⎈Happy Helming!⎈
> helm search repo emqx
NAME CHART VERSION APP VERSION DESCRIPTION
emqx/emqx 4.4.0 4.4.0 A Helm chart for EMQ X
emqx/emqx-ee 4.4.1 4.4.1 A Helm chart for EMQ X
emqx/emqx-operator 1.0.1 1.1.2 A Helm chart for EMQX Operator Controller
emqx/kuiper 0.9.0 0.9.0 A lightweight IoT edge analytic software
安装:
vi values.yaml
:
replicaCount: 1
image:
repository: emqx/emqx
pullPolicy: IfNotPresent
recreatePods: false
podManagementPolicy: Parallel
extraEnv: []
extraEnvFrom: []
extraArgs: []
extraVolumes: []
extraVolumeMounts: []
persistence:
enabled: true
size: 8Gi
storageClass: "local-path"
accessMode: ReadWriteOnce
resources: {}
# limits:
# cpu: 500m
# memory: 512Mi
# requests:
# cpu: 500m
# memory: 512Mi
# Containers that run before the creation of EMQ X containers. They can contain utilities or setup scripts.
initContainers: {}
# - name: mysql-probe
# image: alpine
# command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 mysql 3306 && exit 0 || sleep 3; done; exit 1"]
## EMQ X configuration item, see the documentation (https://hub.docker.com/r/emqx/emqx)
emqxConfig:
EMQX_NAME: "{{ .Release.Name }}"
## Cluster discovery by k8s
EMQX_CLUSTER__DISCOVERY: "k8s"
EMQX_CLUSTER__K8S__APP_NAME: "{{ .Release.Name }}"
EMQX_CLUSTER__K8S__APISERVER: "https://kubernetes.default.svc:443"
EMQX_CLUSTER__K8S__SERVICE_NAME: "{{ .Release.Name }}-headless"
EMQX_CLUSTER__K8S__NAMESPACE: "{{ .Release.Namespace }}"
EMQX_CLUSTER__K8S__ADDRESS_TYPE: "hostname"
EMQX_CLUSTER__K8S__SUFFIX: "svc.cluster.local"
emqxAclConfig: >
{allow, {user, "dashboard"}, subscribe, ["$SYS/#"]}.
{allow, {ipaddr, "127.0.0.1"}, pubsub, ["$SYS/#", "#"]}.
{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
{allow, all}.
emqxLoadedPlugins: >
{emqx_management, true}.
{emqx_recon, true}.
{emqx_retainer, true}.
{emqx_dashboard, true}.
{emqx_telemetry, true}.
{emqx_rule_engine, true}.
{emqx_bridge_mqtt, false}.
emqxLoadedModules: >
{emqx_mod_acl_internal, true}.
{emqx_mod_presence, true}.
{emqx_mod_trace, false}.
{emqx_mod_st_statistics, false}.
{emqx_mod_delayed, false}.
{emqx_mod_rewrite, false}.
{emqx_mod_subscription, false}.
{emqx_mod_topic_metrics, false}.
service:
type: LoadBalancer
mqtt: 1883
mqttssl: 8883
mgmt: 8081
ws: 8083
wss: 8084
dashboard: 18083
podSecurityContext:
enabled: true
fsGroup: 1000
fsGroupChangePolicy: Always
runAsUser: 1000
supplementalGroups:
- 1000
containerSecurityContext:
enabled: true
runAsNonRoot: true
runAsUser: 1000
helm install emqx emqx/emqx --namespace emqx --create-namespace -f ./values.yaml --wait
安装输出:
NAME: emqx
LAST DEPLOYED: Sat Feb 19 20:48:49 2022
NAMESPACE: emqx
STATUS: deployed
REVISION: 1
TEST SUITE: None
EMQX 验证
安装后查看 EMQX 集群情况:
# kubectl -n emqx get pods
NAME READY STATUS RESTARTS AGE
svclb-emqx-kbl22 6/6 Running 0 41s
emqx-0 1/1 Running 0 41s
# kubectl -n emqx exec -it emqx-0 -- emqx_ctl cluster status
Cluster status: #{running_nodes =>
['[email protected]'],
stopped_nodes => []}
# kubectl -n emqx get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
emqx-headless ClusterIP None <none> 1883/TCP,8883/TCP,8081/TCP,8083/TCP,8084/TCP,18083/TCP,4370/TCP 86s
emqx LoadBalancer 10.43.193.192 10.<none> .245 1883:31558/TCP,8883:31122/TCP,8081:31592/TCP,8083:30322/TCP,8084:31095/TCP,18083:32427/TCP 86s
访问控制台:
访问 URL:18083
,输入默认用户名:admin
,默认密码:public
,登陆 EMQX dashboard。
MQTT 消息验证:
可以通过 MQTT X: Cross-platform MQTT 5.0 Desktop Client 连接并进行收发验证。
标签:__,--,TCP,MQTT,emqx,Helm,EMQX,true From: https://blog.51cto.com/ewhisper/5983433