# Overview

This project provides an operator for managing EMQX clusters on Kubernetes.

Note: EMQX Operator Controller requires Kubernetes v1.20.0 and up.

# Running the Operator

# Prepare

We use a cert-manager (opens new window) for provisioning the certificates for the webhook server. You can follow the cert-manager documentation (opens new window) to install it.

# Install

EMQX Operator provides helm and static yaml install, we recommend using helm to install EMQX Operator

# Using helm

helm repo add emqx https://repos.emqx.io/charts
helm repo update
helm install emqx-operator emqx/emqx-operator --set installCRDs=true --namespace emqx-operator-system --create-namespace
1
2
3

# Default static install

The default static configuration can be installed as follows(If you have already installed using Helm, please ignore this step):

kubectl apply -f "https://github.com/emqx/emqx-operator/releases/download/1.2.7/emqx-operator-controller.yaml"
1

# Check EMQX Operator Controller status

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

# Deploy the EMQX Broker

  1. Deploy EMQX Broker Custom Resource

    cat << "EOF" | kubectl apply -f -
    apiVersion: apps.emqx.io/v1beta3
    kind: EmqxBroker
    metadata:
      name: emqx
      labels:
        "foo": "bar"
    spec:
      emqxTemplate:
        image: emqx/emqx:4.4.8
    EOF
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    Full example please check emqxbroker-full.yaml. (opens new window)

  2. Check EMQX Custom Resource status

    $ kubectl get pods
    $ kubectl get emqxbroker emqx -o json | jq ".status.emqxNodes"
    
    1
    2

# Deploy the EMQX Enterprise

  1. Deploy EMQX Enterprise Custom Resource

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

    Full example please check emqxenterprise-full.yaml. (opens new window)

  2. Check EMQX Custom Resource status

  $ kubectl get pods
  $ kubectl get emqxenterprise emqx -o json | jq ".status.emqxNodes"
1
2