Authentication

Connectivity to the MQTT bus is secured via mTLS connection. The Sidecar proxy provides and manages the security aspect for the service consumer, simplifying the user who does not have to create an mTLS but can use a plain connection. For more details, see Architecture.

Authorization

On top of the authentication, the authorization process relies instead on JWT authorization; for this reason the clients need to inject the token provided into the pod by Kubernetes for connecting to the Edge Gateway Service. Clients that need to consume the MQTT API must use kubernetes token as mqtt password once they open the connection with the MQTT Broker. The token can be found inside the pod file system at "/var/run/secrets/kubernetes.io/serviceaccount".

The username used for opening the connection must be a string.

MQTT Client ID

For connecting to the MQTT Bus, an Extension Service must specify an MQTT client ID that must conform to the following format:

<namespace>-<discriminator>

where:
  • <namespace> is the namespace where the extension service is installed. This information is stored into the pod file system, inside the file "/var/run/secrets/kubernetes.io/serviceaccount/namespace"

  • <discriminator> is an alphanumeric string (that is, a string comprising only numeric characters or alphabetic characters [A-Za-z0-9]) of length up to 10 characters

For example, given an extension service X deployed on namespace namespaceX, one of the valid client IDs could be: namespaceX, namespaceX-123, namespaceX-ab14.

How to Connect to the MQTT Bus

To learn how to connect to the MQTT Bus and subscribe to the Egress topic or publish to the Ingress topic, please refer Extension Services Templates.