Here are the relevant configurations for EMQX Custom Resource. You can choose the corresponding APIVersion based on the version of EMQX you wish to deploy. For specific compatibility relationships, please refer to EMQX Operator Compatibility:
Configure EMQX Cluster
The corresponding CRD of EMQX Enterprise in EMQX Operator is EMQX. EMQX CRD supports using .spec.bootstrapConfig to configure the EMQX cluster license. For bootstrapConfig configuration, please refer to the document: bootstrapConfig(opens new window). This field is only allowed to be configured when creating an EMQX cluster and does not support updating. Note: After creating an EMQX cluster, if you need to update the license, please update it through the EMQX Dashboard.
license.key in the bootstrapConfig field indicates the content of the license. In this example, the content of the license is omitted, please fill it in by the user.
Save the above content as emqx.yaml and execute the following command to deploy the EMQX cluster:
$ kubectl apply -f emqx.yaml
emqx.apps.emqx.io/emqx created
1 2 3
Check the status of the EMQX cluster and make sure that STATUS is Running, which may take some time to wait for the EMQX cluster to be ready.
$ kubectl get emqx emqx
NAME IMAGE STATUS AGE
emqx emqx:5.0 Running 10m
1 2 3 4
Create a License-Based Secret
A Secret is an object that contains a small amount of sensitive information such as a password, token, or key. For more detailed documentation on Secret, please refer to: Secret(opens new window). EMQX Operator supports using Secret to mount License information, so we need to create a Secret based on the License before creating an EMQX cluster.
kubectl create secret generic test --from-file=emqx.lic=/path/to/license/file
1
/path/to/license/file indicates the path of the EMQX Enterprise License file, which can be an absolute path or a relative path. For more details on using kubectl to create a Secret, please refer to the document: Using kubectl to create a secret(opens new window).
The output is similar to:
secret/test created
1
Configure EMQX Cluster
The corresponding CRD of EMQX Enterprise in EMQX Operator is EmqxEnterprise. EmqxEnterprise supports configuring EMQX Enterprise License through .spec.license.secretName field. For the specific description of the secretName field, please refer to secretName(opens new window).
From the output results, you can see the basic information of the license we applied for, including applicant information, the maximum number of connections supported by the license, and the expiration time of the license.
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 click Overview and pull down the page to the bottom to see the current license information of the cluster, as shown in the following figure:
Then click the Update License button to upload the latest License Key content, as shown in the following figure:
Finally, click the Save button to save the update. The following picture shows the updated License information:
As can be seen from the above figure, the content of the license has been updated, which means that the license has been updated successfully.
If the certificate information is not updated, you can wait for a while, the update of the license will be delayed. From the above output results, we can see that the content of the License has been updated, which means that the EMQX Enterprise License has been updated successfully.