# Deploy with K8s
EMQX provides the EMQX Kubernetes Operator (opens new window) to automate the creation, configuration, and management of EMQX clusters on Kubernetes (K8s).
EMQX Kubernetes Operator is a new way to create and manage cloud-native EMQX instances based on Kubernetes architectures, which significantly simplifies the deployment and management of EMQX.
TIP
Kubernetes v1.20.0 or higher version is needed.
# Deploy EMQX Kubernetes Operator
We will use cert-manager (opens new window) to provision the certificates for the Webhook server. You can refer to the cert-manager documentation (opens new window) on how to install it.
- To install by Helm, run:
helm repo add emqx https://repos.emqx.io/charts
helm repo update
helm install emqx-operator emqx/emqx-operator --namespace emqx-operator-system --create-namespace
2
3
- Wait till EMQX Operator Controller starts running:
$ 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
2
3
# Deploy EMQX
- To deploy EMQX Custom Resource, run:
cat << "EOF" | kubectl apply -f -
apiVersion: apps.emqx.io/v2alpha1
kind: EMQX
metadata:
name: emqx
spec:
image: emqx/emqx:5.0.14
EOF
2
3
4
5
6
7
8
You can see a complete code example on the GitHub page of EMQX operator (opens new window). For detailed explanation of each field, see EMQX Operator - API Reference (opens new window).
- To check the status of EMQX Custom Resource, run:
kubectl get pods
kubectl get emqx emqx -o json | jq ".status.emqxNodes"
2
mpleted the deployment of EMQX with EMQX Kubernetes Operator. On how to configure, see - Config (opens new window) - Config (opens new window) .
# Deploy on Public Cloud
You can also use EMQX Kubernetes Operator to deploy EMQX cluster on Kubernetes in the Public Cloud, click the link below on how to configure:
# Next steps
Use an MQTT client to connect EMQX for message publish/subscribe. For more information, see Publish and Subscribe.
Or you may click the links below to learn how to use EMQX Kubernetes Operator for standard EMQX cluster configurations: