Skip to content

BYOC on Red Hat OpenShift ​

Run the official connectmqcom/broker image on OpenShift Container Platform 4.11+, Red Hat OpenShift Service on AWS (ROSA), Azure Red Hat OpenShift (ARO) or OpenShift Dedicated. Read the BYOC overview first.

Architecture ​

ConnectMQ BYOC architecture on OpenShift Devices and applications connect over MQTT with TLS through Service type LoadBalancer (not a Route) to the connectmqcom/broker container (Deployment · nonroot-v2 SCC · 1 replica). The broker reads its secret from OpenShift Secrets and writes logs to OpenShift Logging. Message payloads stay in your openshift cluster; only control-plane calls (broker login, client authentication, ACLs, quotas and usage) leave through EgressFirewall · proxy over HTTPS to the ConnectMQ Central API. Users, credentials and ACL policies are managed in the ConnectMQ web console. Devices & applicationsYour OpenShift clusterMessage payloads never leave this accountConnectMQ Cloud · control planeMQTT · TLS 8883TLS 8883 · WSS 8084TCP 1883 · 8083 (or TLS in the container)HTTPS 443 outboundcontrol plane only, no payloadsDevices & gatewaysSensors · ESP32 · Raspberry PiPLCs through ConnectMQ EdgeYour applicationsMES · SCADA · analytics · AI agentsBack ends · browsers over WSSService type LoadBalancer (not a Route)ROSA: AWS NLB · ARO: Azure Load Balancer · bare metal: MetalLB · client IP preservedConnectMQ brokerconnectmqcom/broker:1.0.0Deployment · nonroot-v2 SCC · 1 replicaproject connectmq · 500m CPU · 1 GiMQTT 3.1.1 and 5 · TCP · TLS · WebSocketPorts 1883 · 8883 · 8083 · 8084Non-root (UID 1654)Exactly one container per Broker IDOpenShift Secretsconnectmq · connectmq-certsOpenShift Loggingor oc logsEgressFirewall · proxyegress 443 → brokerapiCentral APIbrokerapi.connectmq.comBroker login · client auth · ACL · quotas · usageWeb consoleapp.connectmq.comUsers · credentials · ACLMQTT messages (stay in your account)Control plane over HTTPS

What is different from plain Kubernetes ​

OpenShift behaviourWhat to do
The default restricted-v2 SCC assigns a random UID, but the image runs as UID 1654Run the pod with a service account that may use the nonroot-v2 SCC (any non-root UID).
Routes are HTTP/SNI routers and hide the client IPDo not expose MQTT through a Route. Use a LoadBalancer service (or MetalLB / NodePort on bare metal).
Projects are namespaces with quotasCreate a dedicated project, for example connectmq.

Deploy ​

Create the project, secrets and service account ​

bash
oc new-project connectmq

oc create secret generic connectmq --from-literal=BROKER_SECRET_KEY='<your-secret>'
oc create secret generic connectmq-certs --from-file=broker.pem=./broker.pem   # optional

oc create serviceaccount connectmq-broker
oc adm policy add-scc-to-user nonroot-v2 -z connectmq-broker

Apply the deployment and service ​

connectmq-broker.yaml:

yaml
apiVersion: apps/v1
kind: Deployment
metadata: {name: connectmq-broker}
spec:
  replicas: 1                     # one pod per Broker ID
  strategy: {type: Recreate}      # never run two pods with the same Broker ID
  selector: {matchLabels: {app: connectmq-broker}}
  template:
    metadata: {labels: {app: connectmq-broker}}
    spec:
      serviceAccountName: connectmq-broker
      securityContext:
        runAsNonRoot: true
        runAsUser: 1654
        runAsGroup: 1654
        fsGroup: 1654
        seccompProfile: {type: RuntimeDefault}
      containers:
      - name: broker
        image: docker.io/connectmqcom/broker:1.0.0
        env:
        - {name: BROKER_ID, value: my-broker-01}
        - {name: PUBLIC_BROKER_ENABLED, value: "false"}
        envFrom: [{secretRef: {name: connectmq}}]
        ports:
        - {containerPort: 1883}
        - {containerPort: 8883}
        - {containerPort: 8083}
        - {containerPort: 8084}
        securityContext:
          allowPrivilegeEscalation: false
          capabilities: {drop: [ALL]}
        resources:
          requests: {cpu: 500m, memory: 1Gi}
          limits: {memory: 2Gi}
        readinessProbe: {tcpSocket: {port: 1883}, periodSeconds: 15}
        volumeMounts:
        - {name: certs, mountPath: /app/certs, readOnly: true}
        - {name: logs, mountPath: /app/logs}
      volumes:
      - name: certs
        secret: {secretName: connectmq-certs, optional: true}
      - name: logs
        emptyDir: {}
---
apiVersion: v1
kind: Service
metadata: {name: connectmq-broker}
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local    # keep the real client IP
  selector: {app: connectmq-broker}
  ports:
  - {name: mqtts, port: 8883, targetPort: 8883}
  - {name: wss,   port: 8084, targetPort: 8084}
bash
oc apply -f connectmq-broker.yaml
oc get service connectmq-broker   # external IP or hostname for your DNS record

Only 8883 and 8084 are exposed here, so mount the connectmq-certs secret (see TLS with Let's Encrypt for the PEM format); add 1883 and 8083 only if the load balancer is internal. To pull through your mirror registry, change image: to its path.

Point DNS at the load balancer ​

Create mqtt.example.com → the external address. Clients connect to mqtts://mqtt.example.com:8883 or wss://mqtt.example.com:8084/mqtt with their ConnectMQ credentials.

Platform notes ​

PlatformLoad balancer
ROSA (AWS)Add service.beta.kubernetes.io/aws-load-balancer-type: nlb to the service annotations to get a Network Load Balancer.
ARO (Azure)The service gets an Azure Load Balancer (layer 4) by default. Use service.beta.kubernetes.io/azure-load-balancer-internal: "true" for a private one.
OpenShift on bare metal / vSphereInstall the MetalLB Operator and give it an address pool, or use a NodePort service behind your own layer-4 load balancer.

Egress: the pod must reach https://brokerapi.connectmq.com (443). If your cluster has an egress firewall (EgressFirewall or a proxy), allow that host.

Not supported on OpenShift ​

Routes and the ingress controller for MQTT traffic (they are layer-7 / SNI routers and do not keep the client IP), and more than one replica per Broker ID.

Next: Verify, update & troubleshoot.

Fully managed MQTT broker for connected devices.