Custom Resource Concept

Kubernetes is an open-source platform for automating the deployment, scaling, and management of containerized applications.

Operators are custom controllers that extend the capabilities of Kubernetes and implement custom functionality to manage applications and their components.

The HiveMQ Platform Operator for Kubernetes manages the HiveMQ platform on Kubernetes. A single HiveMQ Platform Operator can manage one or more HiveMQ platforms.

The HiveMQ Platform Custom Resource Definition (CRD) provides all the necessary definitions and configurations to deploy your HiveMQ platform to a Kubernetes system version 1.22 or higher.

Custom Resource Definition for the HiveMQ Platform

When you install the HiveMQ Platform Operator with the HiveMQ Platform Operator Helm chart, the custom resource definition (CRD) for the new HiveMQ Platform object is installed as well. The CRD is the central definition that enables Kubernetes to recognize your HiveMQ Platform as an object.

List the available CRDs on your Kubernetes cluster:

kubectl get
kubectl get crds (using the abbreviation)

View the HiveMQ Platform CRD:

kubectl describe crd

Once the HiveMQ Platform custom resource definition is deployed on your Kubernetes cluster, you can define and deploy as many HiveMQ Platform custom resources as your individual use case requires.

A custom resource is the concrete manifestation of the custom resource definition.

Your HiveMQ Platform custom resource defines what type of HiveMQ Platform cluster is deployed. The custom resource determines which HiveMQ container image is used, the number of nodes in your cluster, and what configurations are used.

The operator watches for the deployment of new custom resources and installs your HiveMQ platform cluster according to your custom resource specification. If you change an existing custom resource, the operator automatically reconciles your HiveMQ platform cluster with the changes.

To install your custom resource, you can use our preconfigured HiveMQ Platform Helm charts or deploy your own custom resource manually:

kubectl apply -f your-custom-resource.yaml

List the deployed HiveMQ Platform custom resources:

kubectl get
kubectl get hmqp (using the abbreviation)

View your HiveMQ Platform custom resource:

kubectl get hmqp <your-hivemq-platform-name> -o yaml

Deploying the HiveMQ Platform custom resource gives you the ability to design your custom StatefulSet specification and your custom Service specification. This expert mode provides the highest level of flexibility for deploying your custom HiveMQ platform. Don’t forget to deploy any configMaps or secrets that your deployment needs in addition.

Example HiveMQ Platform custom resource:
kind: HiveMQPlatform

  name: my-hivemq-platform
  namespace: default
    key: value
    key: value

  configMapName: my-configmap-name
  healthApiPort: 8889
  logLevel: INFO
  metricsPath: /
  metricsPort: 9399
  operatorRestApiPort: 7979

    id: hivemq-kafka-extension
    enabled: true
    extensionUri: preinstalled
    supportsHotReload: yes
    configMapName: my-kafka-configmap-name

    metadata: {}
      replicas: 2
            - env:
              - name: JAVA_OPTS
                value: -XX:+UnlockExperimentalVMOptions -XX:InitialRAMPercentage=50 -XX:MaxRAMPercentage=50
              name: hivemq
              imagePullPolicy: IfNotPresent
              - containerPort: 1883
                name: mqtt-1883
              - containerPort: 8080
                name: cc-8080
              - containerPort: 9399
                name: metrics-9399
                  cpu: 4
                  memory: 4096M
                  cpu: 4
                  memory: 4096M
  - metadata:
      name: hivemq-hmq-pl-mqtt-1883
      - name: mqtt-1883
        port: 1883
        targetPort: mqtt-1883
  - metadata:
      name: hivemq-hmq-pl-cc-8080
      - name: cc-8080
        port: 8080
        targetPort: cc-8080
  - metadata:
      name: hivemq-hmq-pl-metrics-9399
      - name: metrics-9399
        port: 9399
        targetPort: metrics-9399

The HiveMQ Platform custom resource definition spec contains several configuration sections :

Field Description


Configures the name of the configMap that contains your HiveMQ platform configuration (config.xml). The ConfigMap can contain additional configuration files, such as the configuration to enable tracing.


Defines the HealthAPI port for the HiveMQ platform nodes as an Int. The operator accesses this port to query for the health of the nodes.
The default port address is 8889


Sets the log level for the HiveMQ platform.
Changes to the log level do not prompt a rolling restart of the cluster.
The default log level is INFO.


Defines the path where metrics can be scraped on each HiveMQ platform node. The path is used for monitoring tools such as Prometheus.
The default is /


Defines the port where metrics can be reached on each HiveMQ platform node as an Int. The port is used for monitoring tools such as Prometheus.
The default port address is 9399.


Defines the port where the API and the metrics of the operator can be reached as an Int.
The default port address is 7979


The list of extensions with configuration settings for each extension.

  • id: The string that defines the ID of the extension.
    This ID must match the ID of the extension in the extension.xml file. For example, hivemq-kafka-extension.

  • enabled: Boolean value that defines whether the extension is enabled.
    The default is false.

  • extensionUri: Configures from where the extension is provided.
    The value preinstalled defines that the extension is already installed in the container image. This is a valid setting for all HiveMQ Enterprise Extensions that are part of the HiveMQ platform. Alternatively, you can provide a URI from which the extension zip can be downloaded.

  • supportsHotReload: Boolean value that indicates whether the extension can hot reload its configuration.

  • configMapName: Configures the name of the configMap with the extension configuration.


Defines a list of service objects that are exposed for the HiveMQ Platform. Refer to the Kubernetes service configuration for valid options.

  • metadata: Defines the metadata for the service object.

  • spec: Defines the spec configuration for the service object.


Defines the statefulSet object that is used to deploy the HiveMQ Platform. Refer to the Kubernetes statefulSet configuration for valid options.

  • metadata: Defines the metadata for the statefulSet object.

  • spec: Defines the spec configuration for the statefulSet object.

Lifecycle Management

In addition to the configuration options, the custom resource of a deployed HiveMQ Platform also contains status information. The HiveMQ Platform Operator manages your custom resource and sets different statuses during operations. You can view the current and previous status of your HiveMQ Platform custom resource with this command.

View the status at the end of your HiveMQ Platform custom resource:

kubectl describe hmqp <name of your hivemq platform>
Example HiveMQ Platform custom resource status:
  Message:              HiveMQ Platform is ready
  Observed Generation:  2
  Recovery Information:
    Message:           HiveMQ Platform is starting
    State:             STARTING
    State Phase:       READY
  Restart Extensions:
  State:               RUNNING
  State Phase:         READY