Install EMQX Cluster with EMQX Operator

For more information about latest EMQX Operator, please access githubInstall EMQX Cluster On K8s - 图1 (opens new window).

  1. Use cert-managerInstall EMQX Cluster On K8s - 图2 (opens new window) for provisioning the certificates for the webhook server. Please follow the cert-manager documentationInstall EMQX Cluster On K8s - 图3 (opens new window) to install it。

  2. Install Operator Controller Manager service in one of the following ways:

    • Install with default static files
    1. curl -f -L "https://github.com/emqx/emqx-operator/releases/download/1.2.2/emqx-operator-controller.yaml" | kubectl apply -f -
    • Install with Helm
      • Add the EMQX Helm repository
    1. helm repo add emqx https://repos.emqx.io/charts
    2. helm repo update
    • Install EMQX Operator Controller by Helm
    1. $ helm install emqx-operator emqx/emqx-operator \
    2. --set installCRDs=true \
    3. --namespace emqx-operator-system \
    4. --create-namespace
  3. Check EMQX Operator Controller Status

    1. $ kubectl get pods -l "control-plane=controller-manager" -n emqx-operator-system
    2. NAME READY STATUS RESTARTS AGE
    3. emqx-operator-controller-manager-68b866c8bf-kd4g6 1/1 Running 0 15s
  4. Deploy EMQX Enterprise

  • Deploy EMQX Enterprise Custom Resource

    1. $ cat << "EOF" | kubectl apply -f -
    2. apiVersion: apps.emqx.io/v1beta3
    3. kind: EmqxEnterprise
    4. metadata:
    5. name: emqx-ee
    6. labels:
    7. "foo": "bar"
    8. spec:
    9. emqxTemplate:
    10. image: emqx/emqx-ee:4.4.5
    11. EOF
  • Check EMQX Enterprise status

    1. $ kubectl get pods
    2. NAME READY STATUS RESTARTS AGE
    3. emqx-ee-0 2/2 Running 0 22s
    4. emqx-ee-1 2/2 Running 0 22s
    5. emqx-ee-2 2/2 Running 0 22s
    6. $ kubectl exec -it emqx-ee-0 -c emqx -- emqx_ctl status
    7. Node 'emqx-ee@emqx-ee-0.emqx-ee-headless.default.svc.cluster.local' 4.4.5 is started
    8. $ kubectl exec -it emqx-ee-0 -c emqx -- emqx_ctl cluster status
    9. Cluster status: #{running_nodes =>
    10. ['emqx-ee@emqx-ee-0.emqx-ee-headless.default.svc.cluster.local',
    11. 'emqx-ee@emqx-ee-1.emqx-ee-headless.default.svc.cluster.local',
    12. 'emqx-ee@emqx-ee-2.emqx-ee-headless.default.svc.cluster.local'],
    13. stopped_nodes => []}