Back to Charts

⚠️ DEPRECATED - RabbitMQ High Available

stable/rabbitmq-ha/README.md

latest52.2 KB
Original Source

⚠️ DEPRECATED - RabbitMQ High Available

This chart is deprecated and no longer maintained. It is recommended to use the Bitnami maintained RabbitMQ chart which has a similar feature set, including high availability.

RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP).

TL;DR;

bash
$ helm install stable/rabbitmq-ha

Introduction

This chart bootstraps a RabbitMQ deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.9+ with Beta APIs enabled
  • PV provisioner support in the underlying infrastructure

Installing the Chart

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

bash
$ helm install --name my-release stable/rabbitmq-ha

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

Tip: List all releases using helm list

Upgrading the Chart

To upgrade the chart, you need to make sure that you are using the same value of the rabbitmqErlangCookie amongst the releases. If you didn't define it at the first place, you can upgrade using the following command:

$ export ERLANGCOOKIE=$(kubectl get secrets -n <NAMESPACE> <HELM_RELEASE_NAME>-rabbitmq-ha -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 --decode)
$ helm upgrade \
    --set rabbitmqErlangCookie=$ERLANGCOOKIE \
    <HELM_RELEASE_NAME> stable/rabbitmq-ha

Uninstalling the Chart

To uninstall/delete the my-release deployment:

bash
$ helm delete my-release

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

Configuration

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

ParameterDescriptionDefault
existingConfigMapUse an existing ConfigMapfalse
existingSecretUse an existing secret for password, managementPassword & erlang cookie""                              
extraPluginsAdditional plugins to add to the default configmaprabbitmq_shovel, rabbitmq_shovel_management, rabbitmq_federation, rabbitmq_federation_management,
extraConfigAdditional configuration to add to default configmap{}
extraContainersAdditional containers passed through the tpl[]
extraInitContainersAdditional init containers passed through the tpl[]
envEnvironment variables to set for Rabbitmq container{}
advancedConfigAdditional configuration in classic config format""
definitions.globalParametersPre-configured global parameters""
definitions.usersAdditional users""
definitions.vhostsAdditional vhosts""
definitions.parametersAdditional parameters""
definitions.permissionsAdditional permissions""
definitions.topicPermissionsAdditional permissions for topic management""
definitions.queuesPre-created queues""
definitions.exchangesPre-created exchanges""
definitions.bindingsPre-created bindings""
definitions.policiesHA policies to add to definitions.json""
definitionsSourceUse this key within an existing secret to reference the definitions specification"definitions.json"
forceBootForce the cluster to start even if it was shutdown in an unexpected order, preferring availability over integrityfalse
lifecycleRabbitMQ container lifecycle hooks{}
image.pullPolicyImage pull policyIfNotPresent
image.repositoryRabbitMQ container image repositoryrabbitmq
image.tagRabbitMQ container image tag3.8.7-alpine
image.pullSecretsSpecify docker-registry secret names as an array[]
managementPasswordManagement user password.random 24 character long alphanumeric string
managementUsernameManagement user with minimal permissions used for health checksmanagement
nodeSelectorNode labels for pod assignment{}
persistentVolume.accessModePersistent volume access modes[ReadWriteOnce]
persistentVolume.annotationsPersistent volume annotations{}
persistentVolume.labelsPersistent volume labels{}
persistentVolume.enabledIf true, persistent volume claims are createdfalse
persistentVolume.namePersistent volume namedata
persistentVolume.sizePersistent volume size8Gi
persistentVolume.storageClassPersistent volume storage class-
persistentVolume.selectorPersistent volume selector{}
podAntiAffinityPod anti-affinity, hard or softsoft
podAntiAffinityTopologyKeyTopologyKey for anti-affinity, default is hostname"kubernetes.io/hostname"
affinityAffinity settings. If specified, this will disable podAntiAffinity settings. If you still need anti-affinity, you must include the configuration here.{}
podDisruptionBudgetPod Disruption Budget rules{}
podManagementPolicyWhether the pods should be restarted in parallel or one at a time. Either OrderedReady or Parallel.OrderedReady
prometheus.exporter.enabledConfigures Prometheus Exporter to expose and scrape statsfalse
prometheus.exporter.envEnvironment variables to set for Exporter container{}
prometheus.exporter.image.repositoryPrometheus Exporter repositorykbudde/rabbitmq-exporter
prometheus.exporter.image.tagImage Tagv0.29.0
prometheus.exporter.image.pullPolicyImage Pull PolicyIfNotPresent
prometheus.exporter.portPort Prometheus scrapes for metrics9090
prometheus.exporter.capabilitiesComma-separated list of extended scraping capabilities supported by the target RabbitMQ server. Click here for details.bert,no_sort
prometheus.exporter.resourcesResource Limits for Prometheus Exporter{}
prometheus.operator.enabledAre you using Prometheus Operator? Blog Posttrue
prometheus.operator.alerts.enabledCreate default Alerts for RabbitMQtrue
prometheus.operator.alerts.selectorSelector to find ConfigMaps and create Prometheus Alertsalert-rules
prometheus.operator.alerts.labelsLabels to add to Alerts{}
prometheus.operator.serviceMonitor.intervalHow often Prometheus Scrapes metrics10s
prometheus.operator.serviceMonitor.scrapeTimeoutSpecify the timeout after which the scrape is endednil
prometheus.operator.serviceMonitor.namespaceNamespace which Prometheus is installedmonitoring
prometheus.operator.serviceMonitor.selectorLabel Selector for Prometheus to find ServiceMonitors{ prometheus: kube-prometheus }
rabbitmqCert.enabledMount a Secret container certificatesfalse
rabbitmqCert.cacertfilebase64 encoded CA certificate (overwrites existing Secret)``
rabbitmqCert.certfilebase64 encoded server certificate (overwrites existing Secret)``
rabbitmqCert.existingSecretName of an existing Secret to mount for amqps""
rabbitmqCert.keyfilebase64 encoded server private key (overwrites existing Secret)``
rabbitmqClusterPartitionHandlingAutomatic Partition Handling Strategy (split brain handling)autoheal
extraVolumesExtra volumes to attach to the statefulset[]
extraVolumeMountsExtra volume mounts to mount to the statefulset[]
rabbitmqEpmdPortEPMD port used for cross cluster replication4369
rabbitmqErlangCookieErlang cookierandom 32 character long alphanumeric string
rabbitmqHipeCompilePrecompile parts of RabbitMQ using HiPEfalse
rabbitmqMQTTPlugin.configMQTT configuration``
rabbitmqMQTTPlugin.enabledEnable MQTT pluginfalse
rabbitmqManagerPortRabbitMQ Manager port15672
rabbitmqMemoryHighWatermarkMemory high watermark256MB
rabbitmqMemoryHighWatermarkTypeMemory high watermark type. Either absolute or relativeabsolute
rabbitmqNodePortNode port5672
rabbitmqPasswordRabbitMQ application passwordrandom 24 character long alphanumeric string
rabbitmqSTOMPPlugin.configSTOMP configuration``
rabbitmqSTOMPPlugin.enabledEnable STOMP pluginfalse
rabbitmqUsernameRabbitMQ application usernameguest
rabbitmqVhostRabbitMQ application vhost/
rabbitmqWebMQTTPlugin.configMQTT over websocket configuration``
rabbitmqWebMQTTPlugin.enabledEnable MQTT over websocket pluginfalse
rabbitmqWebSTOMPPlugin.configSTOMP over websocket configuration``
rabbitmqWebSTOMPPlugin.enabledEnable STOMP over websocket pluginfalse
rabbitmqPrometheusPlugin.enabledEnable native RabbitMQ prometheus plugin. (Available in RabbitMQ 3.8)false
rabbitmqPrometheusPlugin.nodePortExposes the native prometheus metrics port on the given NodePortnull
rabbitmqPrometheusPlugin.portThe port RabbitMQ prometheus plugin will use15692
rabbitmqPrometheusPlugin.pathThe path RabbitMQ prometheus plugin will use/metrics
rabbitmqPrometheusPlugin.configRabbitMQ prometheus plugin additional configuration``
rbac.createIf true, create & use RBAC resourcestrue
replicaCountNumber of replica3
resourcesCPU/Memory resource requests/limits{}
initContainer.enabledEnable the default initContainertrue
initContainer.securityContext.runAsGroupGroup ID for the initContainer0
initContainer.securityContext.runAsUserUser ID for the initContainer0
initContainer.securityContext.runAsNonRootEnforce non-root user ID for the initContainerfalse
initContainer.chownFilesEnforce file permissions to /var/lib/rabbitmq/ and /etc/rabbitmqtrue
initContainer.resourcesCPU/Memory resource requests/limits for init container{}
schedulerNamealternate scheduler namenil
securityContext.fsGroupGroup ID for the container's volumes101
securityContext.runAsGroupGroup ID for the container101
securityContext.runAsNonRootEnforce non-root user ID for the containertrue
securityContext.runAsUserUser ID for the container100
serviceAccount.createCreate service accounttrue
serviceAccount.automountServiceAccountTokenAutomount API credentials for a service accounttrue
serviceAccount.nameService account name to usename of the release
service.annotationsAnnotations to add to the service{}
service.clusterIPIP address to assign to the serviceNone
service.externalIPsService external IP addresses[]
service.loadBalancerIPIP address to assign to load balancer (if supported)""
service.externalTrafficPolicySets the external traffic policy for the service""
service.loadBalancerSourceRangesList of IP CIDRs allowed access to load balancer (if supported)[]
service.typeType of service to createClusterIP
service.discovery.separateAnnotationsControl if discovery service should have it's own annotations instead of service.annotationsfalse
service.discovery.annotationsAnnotations to add to the discovery service{}
ingress.enabledEnable Ingressfalse
ingress.pathIngress path/
ingress.hostNameIngress hostname
ingress.tlsEnable Ingress TLSfalse
ingress.tlsSecretIngress TLS secret namemyTlsSecret
ingress.annotationsIngress annotations{}
tolerationsToleration labels for pod assignment[]
podAnnotationsExtra annotations to add to pod{}
statefulSetAnnotationsExtra annotations to add the statefulSet{}
terminationGracePeriodSecondsDuration pod needs to terminate gracefully10
updateStrategyStatefulset update strategyOnDelete
priorityClassNameStatefulsets Pod Priority``
extraLabelsLabels to add to the Resources{}
busyboxImage.repositoryBusybox initContainer image repobusybox
busyboxImage.tagBusybox initContainer image tag1.30.1
busyboxImage.pullPolicyBusybox initContainer image pullPolicyIfNotPresent
clusterDomainThe internal Kubernetes cluster domaincluster.local

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

bash
$ helm install --name my-release \
  --set rabbitmqUsername=admin,rabbitmqPassword=secretpassword,managementPassword=anothersecretpassword,rabbitmqErlangCookie=secretcookie \
    stable/rabbitmq-ha

The above command sets the RabbitMQ admin username and password to admin and secretpassword respectively. Additionally the management user password is set to anothersecretpassword and the secure erlang cookie is set to secretcookie.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

bash
$ helm install --name my-release -f values.yaml stable/rabbitmq-ha

Tip: You can use the default values.yaml

Custom ConfigMap

When creating a new chart with this chart as a dependency, existingConfigMap can be used to override the default configmap.yaml provided. It also allows for providing additional configuration files that will be mounted into /etc/definitions. In the parent chart's values.yaml, set the value to true and provide the file [templates/configmap.yaml][] for your use case.

Example of using RabbitMQ definition to setup users, permissions or policies:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-release-rabbitmq-ha
data:
  enabled_plugins: |
    [
      rabbitmq_consistent_hash_exchange,
      rabbitmq_federation,
      rabbitmq_federation_management,
      rabbitmq_management,
      rabbitmq_peer_discovery_k8s,
      rabbitmq_shovel,
      rabbitmq_shovel_management
    ].
  rabbitmq.conf: |
    # ....
    management.load_definitions = /etc/definitions/definitions.json
  definitions.json: |
    {
      "permissions": [],
      "users": [],
      "policies: []
    }

Then, install the chart with the above configuration:

$ helm install --name my-release --set existingConfigMap=true stable/rabbitmq-ha

Custom Secret

Similar to custom ConfigMap, existingSecret can be used to override the default secret.yaml provided, and rabbitmqCert.existingSecret can be used to override the default certificates. The custom secret must provide the following keys:

  • rabbitmq-username
  • rabbitmq-password
  • rabbitmq-management-username
  • rabbitmq-management-password
  • rabbitmq-erlang-cookie
  • definitions.json (the name can be altered by setting the definitionsSource)

Prometheus Monitoring & Alerts

As of RabbitMQ 3.8.0, it is possible to enable Prometheus metrics natively, no need to run an external exporter. To enable native Prometheus metrics, set rabbitmqPrometheusPlugin.enabled to true. This will expose all RabbitMQ node metrics via the <<rabbitmqhost>>:15692/metrics URL. Since all metrics are node local, they add the least pressure on RabbitMQ and will be available for as long as RabbitMQ is running, regardless of inter-node pressure or other nodes in the cluster going away.

To learn more about RabbitMQ's native support for Prometheus, please refer to the official Monitoring with Prometheus & Grafana guide.

Team RabbitMQ manages Grafana dashboards that are meant to be used with the native Prometheus support. They are publicly available at grafana.com/orgs/rabbitmq.

To enable metrics via the traditional rabbitmq_exporter sidecar container, set prometheus.enabled to true. See values.yaml file for more details and configuration options.

Usage of the tpl Function

The tpl function allows us to pass values from values.yaml through the templating engine. It is used for the following values:

  • extraContainers
  • extraInitContainers
  • persistentVolume.annotations
  • persistentVolume.labels
  • service.annotations