# Configure EMQX Service

# Task target

  • How to configure EMQX Cluster Service.

# Configure EMQX cluster

Save the above content as: emqx-service.yaml, and execute the following command to deploy the EMQX cluster:

kubectl apply -f emqx-service.yaml
1

The output is similar to:

emqx.apps.emqx.io/emqx created
1
  • Check whether the EMQX cluster is ready

# Check whether EMQX Service is ready

  • Use the command line to view the EMQX cluster Service
kubectl get svc -l apps.emqx.io/instance=emqx
1

The output is similar to:

NAME             TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)                          AGE
emqx-dashboard   NodePort   10.101.225.238   <none>        18083:32012/TCP                  32s
emqx-listeners   NodePort   10.97.59.150     <none>        1883:32010/TCP,14567:32011/UDP   10s
1
2
3
  • Use MQTT X to connect to the EMQX cluster to send messages

Click the button to create a new connection on the MQTT X page, and configure the EMQX cluster node information as shown in the figure. After configuring the connection information, click the connect button to connect to the EMQX cluster:

Then click the Subscribe button to create a new subscription, as shown in the figure, MQTT X has successfully connected to the EMQX cluster and successfully created the subscription:

After successfully connecting to the EMQX cluster and creating a subscription, we can send messages to the EMQX cluster, as shown in the following figure:

  • Add new listeners through EMQX Dashboard

Open the browser, enter the host IP and port 32012 where the EMQX Pod is located, log in to the EMQX cluster Dashboard (Dashboard default user name: admin, default password: public), enter the Dashboard and click Configuration → Listeners to enter the listener page, We first click the Add Listener button to add a listener named test and port 1884, as shown in the figure below:

Then click the Add button to create the listener, as shown in the following figure:

As can be seen from the figure, the test listener we created has taken effect.

  • Check whether the newly added listener is injected into the Service
kubectl get svc -l apps.emqx.io/instance=emqx
1

The output is similar to:

NAME             TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)                                         AGE
emqx-dashboard   NodePort   10.105.110.235   <none>        18083:32012/TCP                                 13m
emqx-listeners   NodePort   10.106.1.58      <none>        1883:32010/TCP,14567:32011/UDP,1884:30763/TCP   12m
1
2
3

From the output results, we can see that the newly added listener 1884 has been injected into the emqx-listeners Service.