mosquitto

by NaPs

Helm chartv1.0.4App 1.6.12

A Helm chart packaging Mosquitto

About this chart

Mosquitto

This chart installs Mosquitto, an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.

TL;DR;

$ helm repo add naps https://naps.github.io/helm-charts/
$ helm install my-release naps/mosquitto

Installing the Chart

To install the chart with the release name my-release:

$ helm install my-release naps/mosquitto

The command deploys Mosquitto on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Parameters

The following table lists the configurable parameters of the Redis chart and their default values.

ParameterDescriptionDefault
replicaCountNumber of Mosquitto Pods to run1
image.repositoryMosquitto imageeclipse-mosquitto
image.pullPolicyMosquitto image pull policyIfNotPresent
imagePullSecretsDocker-registry secret names as an array[]
nameOverrideString to partially override mosquitto.fullname template with a string (will prepend the release name)""
fullnameOverrideString to fully override mosquitto.fullname template with a string""
podSecurityContextSecurity context (Pod wide){}
securityContextSecurity context (Mosquitto container wide){}
service.typeKubernetes Service typeClusterIP
service.ports.mqttPort to use for MQTT protocol1883
service.ports.mqttsslPort to use for MQTT over SSL protocol8883
service.ports.mqttwsPort to use for MQTT over WebSocket protocol9001
resourcesMosquitto CPU/Memory resource requests/limits{}
nodeSelectorMosquitto labels for pod assignment{}
tolerationsToleration labels for Mosquitto pod assignment[]
affinityAffinity settings for Mosquitto pod assignment{}
mosquitto.configExtra configuration to be appended to the Mosquitto configuration""
mosquitto.usersMosquitto users configuration""
mosquitto.aclsMosquitto ACLs configuration""
mosquitto.ssl.enabledEnable the SSL socket on Mosquittofalse
mosquitto.ssl.portNamePort name (in Service ports) to use for SSLmqttssl
mosquitto.ssl.secretNameSecret name to use to retrieve the SSL certificatemosquitto-ssl
mosquitto.ssl.certificate.enabledEnable the Certificate resources (cert-manager integration)false
mosquitto.ssl.certificate.dnsNamesCertificate DNS names[]
mosquitto.ssl.certificate.issuerRef.groupCertificate issuer group to usecert-manager.io
mosquitto.ssl.certificate.issuerRef.kindCertificate issuer kind to useClusterIssuer
mosquitto.ssl.certificate.issuerRef.nameCertificate issuer name to useletsencrypt
mosquitto.persistence.enabledEnable Mosquitto persistencyfalse
mosquitto.persistence.pathPath to mount the volume at, to use other images/mosquitto/data
mosquitto.persistence.subPathSubdirectory of the volume to mount at""
mosquitto.persistence.existingClaimUse an existing PVC to persist data""
mosquitto.persistence.storageClassStorage class of backing PVCsee values.yaml
mosquitto.persistence.accessModesPersistent Volume Access Modes["ReadWriteOnce"]
mosquitto.persistence.sizeSize of data volume1Gi
mosquitto.persistence.matchLabelsmatchLabels persistent volume selector{}
mosquitto.persistence.matchExpressionsmatchExpressions persistent volume selector{}

Configuration

Secrets

The following secrets are configurable:

  • username
  • password

Labels

You can use the following labels for maximum fun.

  • lol=cat

Environment Variables

The foo pods also have the following environment variables:

  • getfired
  • false: does something totally reasonable.
  • true: close your laptop and walk out.

Usage

Once installed, you can access the application by (hitting a url | executing a command) as follows:

export NODEPORT=`kubectl get svc --selector='app=foo,heritage=helm' --output=template --template="{{ with index .items 0}}{{with index .spec.ports 0 }}{{.nodePort}}{{end}}{{end}}"`
export NODE=`kubectl get nodes --output=template --template="{{with index .items 0 }}{{.metadata.name}}{{end}}"`

curl http://$NODE:$NODEPORT

--or--

export PODNAME=`kubectl get pod --selector='app=foo,heritage=helm' --output=template --template="{{with index .items 0}}{{.metadata.name}}{{end}}"

kubectl exec $PODNAME command

The foo pods can also be scaled:

kubectl scale rc foo --replicas=10

More Info

The Baz Foundation is the best resource for all things Foo:

http://baz.org

Deploy mosquitto with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mosquitto on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmosquitto is pinned at v1.0.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply