Bitnami的RabbitMQ Helm chart,用于在Kubernetes环境中便捷、可靠地部署和管理RabbitMQ消息队列。
Bitnami Secure Images Helm chart for RabbitMQ
RabbitMQ is an open source general-purpose message broker that is designed for consistent, highly-available messaging scenarios (both synchronous and asynchronous).
https://www.rabbitmq.com
Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
TL;DR
consolehelm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/rabbitmq
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository.
Introduction
This chart bootstraps a https://github.com/bitnami/containers/tree/main/bitnami/rabbitmq deployment on a https://kubernetes.io cluster using the https://helm.sh package manager.
Before you begin
- Kubernetes 1.23+
- Helm 3.8.0+
- PV provisioner support in the underlying infrastructure
Installing the Chart
To install the chart with the release name my-release:
consolehelm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/rabbitmq
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to useREGISTRY_NAME=registry-1.docker.ioandREPOSITORY_NAME=bitnamicharts.
The command deploys RabbitMQ 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
Configuration and installation details
This section describes credentials, configuration, and other installation options.
Resource requests and limits
Bitnami charts allow setting resource requests and limits for all containers inside the chart deployment. These are inside the resources value (check parameter table). Setting requests is essential for production workloads and these should be adapted to your specific use case.
To make this process easier, the chart contains the resourcesPreset values, which automatically sets the resources section according to different presets. Check these presets in https://github.com/bitnami/charts/blob/main/bitnami/common/templates/_resources.tpl#L15. However, in production workloads using resourcesPreset is discouraged as it may not fully adapt to your specific needs. Find more information on container resource management in the https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/.
Prometheus metrics
This chart can be integrated with Prometheus by setting metrics.enabled to true. This enable the https://github.com/rabbitmq/rabbitmq-server/tree/c4d9a840c2611290a128ab6d914d2791e2ff302d/deps/rabbitmq_prometheus and expose a metrics endpoints in all pods and the RabbitMQ service. The service will have the necessary annotations to be automatically scraped by Prometheus.
Prometheus requirements
It is necessary to have a working installation of Prometheus or Prometheus Operator for the integration to work. Install the https://github.com/bitnami/charts/tree/main/bitnami/prometheus or the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus to easily have a working Prometheus in your cluster.
Integration with Prometheus Operator
The chart can deploy ServiceMonitor objects for integration with Prometheus Operator installations. There are different ServiceMonitor objects per RabbitMQ endpoints. The chart includes:
metrics.serviceMonitor.defaultfor the/metricsendpoint.metrics.serviceMonitor.perObjectfor the/metrics/per-objectendpoint.metrics.serviceMonitor.detailedfor the/metrics/detailedendpoint.
Enable each ServiceMonitor by setting metrics.serviceMonitor.*.enabled=true. Ensure that the Prometheus Operator CustomResourceDefinitions are installed in the cluster or it will fail with the following error:
textno matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
Install the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus for having the necessary CRDs and the Prometheus Operator.
https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/apps-tutorials-understand-rolling-tags-containers-index.html
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
Set pod affinity
This chart allows you to set your custom affinity using the affinity parameter. Find more information about Pod's affinity in the https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity.
As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the https://github.com/bitnami/charts/tree/main/bitnami/common#affinities chart. To do so, set the podAffinityPreset, podAntiAffinityPreset, or nodeAffinityPreset parameters.
Scale horizontally
To horizontally scale this chart once it has been deployed, two options are available:
- Use the
kubectl scalecommand. - Upgrade the chart modifying the
replicaCountparameter.
textreplicaCount=3 auth.password="$RABBITMQ_PASSWORD" auth.erlangCookie="$RABBITMQ_ERLANG_COOKIE"
NOTE: It is mandatory to specify the password and Erlang cookie that was set the first time the chart was installed when upgrading the chart. Otherwise, new pods won't be able to join the cluster.
When scaling down the solution, unnecessary RabbitMQ nodes are automatically stopped, but they are not removed from the cluster. These nodes must be manually removed via the rabbitmqctl forget_cluster_node command.
For instance, if RabbitMQ was initially installed with three replicas and then scaled down to two replicas, run the commands below (assuming that the release name is rabbitmq and the clustering type is hostname):
consolekubectl exec rabbitmq-0 --container rabbitmq -- rabbitmqctl forget_cluster_node rabbit@rabbitmq-2.rabbitmq-headless.default.svc.cluster.local kubectl delete pvc data-rabbitmq-2
NOTE: It is mandatory to specify the password and Erlang cookie that was set the first time the chart was installed when upgrading the chart.
Securing traffic using TLS
To enable TLS support, first generate the certificates as described in the https://www.rabbitmq.com/ssl.html#automated-certificate-generation.
Once the certificates are generated, you have two alternatives:
- Create a secret with the certificates and associate the secret when deploying the chart
- Include the certificates in the values.yaml file when deploying the chart
Set the auth.tls.failIfNoPeerCert parameter to false to allow a TLS connection if the client fails to provide a certificate.
Set the auth.tls.sslOptionsVerify to verify_peer to force a node to perform peer verification. When set to verify_none, peer verification will be disabled and certificate exchange won't be performed.
This chart also facilitates the creation of TLS secrets for use with the Ingress controller (although this is not mandatory). There are several common use cases:
- Generate certificate secrets based on chart parameters.
- Enable externally generated certificates.
- Manage application certificates via an external service (like https://github.com/jetstack/cert-manager/).
- Create self-signed certificates within the chart (if supported).
In the first two cases, a certificate and a key are needed. Files are expected in .pem format.
Here is an example of a certificate file:
NOTE: There may be more than one certificate if there is a certificate chain.
text-----BEGIN CERTIFICATE----- MIID6TCCAtGgAwIBAgIJAIaCwivkeB5EMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV ... jScrvkiBO65F46KioCL9h5tDvomdU1aqpI/CBzhvZn1c0ZTf87tGQR8NK7v7 -----END CERTIFICATE-----
Here is an example of a certificate key:
text-----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEAvLYcyu8f3skuRyUgeeNpeDvYBCDcgq+LsWap6zbX5f8oLqp4 ... wrj2wDbCDCFmfqnSJ+dKI3vFLlEz44sAV8jX/kd4Y6ZTQhlLbYc= -----END RSA PRIVATE KEY-----
- If using Helm to manage the certificates based on the parameters, copy these values into the
certificateandkeyvalues for a given*.ingress.secretsentry. - If managing TLS secrets separately, it is necessary to create a TLS secret with name
INGRESS_HOSTNAME-tls(where INGRESS_HOSTNAME is a placeholder to be replaced with the hostname you set using the*.ingress.hostnameparameter). - If your cluster has a https://github.com/jetstack/cert-manager add-on to automate the management and issuance of TLS certificates, add to
*.ingress.annotationsthe https://cert-manager.io/docs/usage/ingress/#supported-annotations for cert-manager. - If using self-signed certificates created by Helm, set both
*.ingress.tlsand*.ingress.selfSignedtotrue.
Load custom definitions
It is possible to https://www.rabbitmq.com/management.html#load-definitions. Follow the steps below:
Because definitions may contain RabbitMQ credentials, https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod. Within the secret's data, choose a key name that corresponds with the desired load definitions filename (i.e. load_definition.json) and use the JSON object as the value.
Next, specify the load_definitions property as an extraConfiguration pointing to the load definition file path within the container (i.e. /app/load_definition.json) and set loadDefinition.enable to true. Any load definitions specified will be available within in the container at /app.
NOTE: Loading a definition will take precedence over any configuration done through Helm values.
If needed, you can use extraSecrets to let the chart create the secret for you. This way, you don't need to manually create it before deploying a release. These secrets can also be templated to use supplied chart values. Here is an example:
yamlauth: password: CHANGEME extraSecrets: load-definition: load_definition.json: | { "users": [ { "name": "{{ .Values.auth.username }}", "password": "{{ .Values.auth.password }}", "tags": "administrator" } ], "vhosts": [ { "name": "/" } ] } loadDefinition: enabled: true existingSecret: load-definition extraConfiguration: | load_definitions = /app/load_definition.json
Update credentials
The Bitnami RabbitMQ chart, when upgrading, reuses the secret previously rendered by the chart or the one specified in auth.existingSecret. To update credentials, use one of the following:
- Run
helm upgradespecifying a new password inauth.passwordandauth.updatePassword=true. - Run
helm upgradespecifying a new secret inauth.existingSecretandauth.updatePassword=true.
Configure LDAP support
LDAP support can be enabled in the chart by specifying the ldap.* parameters while creating a release. For example:
textldap.enabled="true" ldap.server="my-ldap-server" ldap.port="389" ldap.user_dn_pattern="cn=${username},dc=example,dc=org"
If ldap.tls.enabled is set to true, *** using ldap.port=636 and checking the settings in the advancedConfiguration chart parameters.
Configure memory high watermark
It is possible to configure a memory high watermark on RabbitMQ to define https://www.rabbitmq.com/memory.html#threshold using the memoryHighWatermark.* parameters. To do so, you have two alternatives:
- Set an absolute limit of RAM to be used on each RabbitMQ node, as shown in the configuration example below:
textmemoryHighWatermark.enabled="true" memoryHighWatermark.type="absolute" memoryHighWatermark.value="512Mi"
- Set a relative limit of RAM to be used on each RabbitMQ node. To enable this feature, define the memory limits at pod level too. An example configuration is shown below:
textmemoryHighWatermark.enabled="true" memoryHighWatermark.type="relative" memoryHighWatermark.value="0.4" resources.limits.memory="2Gi"
Gateway API
This chart provides support for exposing RabbitMQ management console using the https://gateway-api.sigs.k8s.io/ and its HTTPRoute resource. If you have a Gateway controller installed on your cluster, such as APISIX, Contour, Envoy Gateway, NGINX Gateway Fabric or Kong Ingress Controller you can utilize the Gateway controller to serve your application. To enable Gateway API integration, set httpRoute.enabled to true.
The Gateway to be used can be customized by setting the httpRoute.parentRefs parameter. By default, it will reference a Gateway named gateway in the same namespace as the release.
You can specify the list of hostnames to be mapped to the deployment using the httpRoute.hostnames parameter. Additionally, you can customize the rules used to route the traffic to the service by modifying the httpRoute.matches and httpRoute.filters parameters or adding new rules using the httpRoute.extraRules parameter.
Add extra environment variables
In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the extraEnvVars property.
yamlextraEnvVars: - name: LOG_LEVEL value: error
Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the .extraEnvVarsCM or the extraEnvVarsSecret properties.
Configure the default user/vhost
If you want to create default user/vhost and set the default permission. you can use extraConfiguration:
yamlauth: username: default-user extraConfiguration: |- default_vhost = default-vhost default_permissions.configure = .* default_permissions.read = .* default_permissions.write = .*
Use plugins
The Bitnami Docker RabbitMQ image ships a set of plugins by default. By default, this chart enables rabbitmq_management and rabbitmq_peer_discovery_k8s since they are required for RabbitMQ to work on K8s.
To enable extra plugins, set the extraPlugins parameter with the list of plugins you want to enable. In addition to this, the communityPlugins parameter can be used to specify a list of URLs (separated by spaces) for custom plugins for RabbitMQ.
textcommunityPlugins="http://URL-TO-PLUGIN/" extraPlugins="my-custom-plugin"
Advanced logging
In case you want to configure RabbitMQ logging set logs value to false and set the log config in extraConfiguration following the https://www.rabbitmq.com/logging.html#log-file-location.
An example:
yamllogs: false # custom logging extraConfiguration: | log.default.level = warning log.file = false log.console = true log.console.level = warning log.console.formatter = json
How to Avoid Deadlocked Deployments After a Cluster-Wide Restart
RabbitMQ nodes assume their peers come back online within five minutes (by default). When the OrderedReady pod management policy is used with a readiness probe that implicitly requires a fully booted node, the deployment can deadlock:
- Kubernetes will expect the first node to pass a readiness probe
- The readiness probe may require a fully booted node
- The node will fully boot after it detects that its peers have come online
- Kubernetes will not start any more pods until the first one boots
The following combination of deployment settings avoids the problem:
- Use
podManagementPolicy: "Parallel"to boot multiple cluster nodes in parallel - Use
rabbitmq-diagnostics pingfor readiness probe
To learn more, please consult RabbitMQ documentation guides:
- https://www.rabbitmq.com/docs/clustering#restarting
- https://www.rabbitmq.com/docs/clustering#restarting-readiness-probes
- https://www.rabbitmq.com/docs/cluster-formation#peer-discovery-k8s for Operator-less (DIY) deployments to Kubernetes
Do Not Force Boot Nodes on a Regular Basis
Note that forcing nodes to boot is not a solution and doing so can be dangerous. Forced booting is a last resort mechanism in RabbitMQ that helps make remaining cluster nodes recover and rejoin each other after a permanent loss of some of their former peers. In other words, forced booting a node is an emergency event recovery procedure.
Known issues
- Changing the password through RabbitMQ's UI can make the pod fail due to the default liveness probes. If you do so, remember to make the chart aware of the new password. Updating the default secret with the password you set through RabbitMQ's UI will automatically recreate the pods. If you are using your own secret, you may have to manually recreate the pods.
Backup and restore
To back up and restore Helm chart deployments on Kubernetes, you need to back up the persistent volumes from the source deployment and attach them to a new deployment using https://velero.io/, a Kubernetes backup/restore tool. Find the instructions for using Velero in https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/apps-tutorials-backup-restore-deployments-velero-index.html.
FIPS parameters
The FIPS parameters only have effect if you are using images from the https://go-vmware.broadcom.com/contact-us.
For more information on this new support, please refer to the https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/security-frameworks-FIPS-compliance.html.
Persistence
The https://github.com/bitnami/containers/tree/main/bitnami/rabbitmq image stores the RabbitMQ data and configurations at the /opt/bitnami/rabbitmq/var/lib/rabbitmq/ path of the container.
The chart mounts a https://kubernetes.io/docs/concepts/storage/persistent-volumes/ at this location. By default, the volume is created using dynamic volume provisioning. An existing PersistentVolumeClaim can also be defined.
Use existing PersistentVolumeClaims
- Create the PersistentVolume
- Create the PersistentVolumeClaim
- Install the chart
consolehelm install my-release --set persistence.existingClaim=PVC_NAME oci://REGISTRY_NAME/REPOSITORY_NAME/rabbitmq
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to useREGISTRY_NAME=registry-1.docker.ioandREPOSITORY_NAME=bitnamicharts.
Adjust permissions of the persistence volume mountpoint
As the image runs as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container can write data into it.
By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions.
As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination.
You can enable this initContainer by setting volumePermissions.enabled to true.
Prometheus Metrics
RabbitMQ has https://www.rabbitmq.com/docs/prometheus#default-endpoint for Prometheus metrics
exposed at GET /metrics. However, these metrics are all cluster-wide, and do not show any per-queue or per-node
metrics.
To get per-object metrics, there is a
https://www.rabbitmq.com/docs/prometheus#detailed-endpoint at GET /metrics/detailed that
accepts query parameters to choose which metric families you would like to see. For instance, you can pass
family=node_coarse_metrics&family=queue_coarse_metrics to see per-node and per-queue metrics, but with no need to see
Erlang, connection, or channel metrics.
Additionally, there is a https://www.rabbitmq.com/docs/prometheus#per-object-endpoint:
GET /metrics/per-object. which returns all per-object metrics. However, this can be computationally expensive on a
large cluster with many objects, and so RabbitMQ docs suggest using GET /metrics/detailed mentioned above to filter
your scraping and only fetch the per-object metrics that are needed for a given monitoring application.
Because they expose different sets of data, a valid use case is to scrape metrics from both GET /metrics and
GET /metrics/detailed, ingesting both cluster-level and per-object metrics. The metrics.serviceMonitor.default and
metrics.serviceMonitor.detailed values support configuring a ServiceMonitor that targets one or both of these metrics.
Parameters
The following subsections list global, common, and component-specific parameters.
Global parameters
| Name | Description | Value |
|---|---|---|
global.imageRegistry | Global Docker image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array |
Note: the README for this chart is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-app-doc/apps-charts-rabbitmq-index.html
bitnamicharts 命名空间的其他可用镜像:
bitnamicharts/mysql
bitnamicharts/kafka
bitnamicharts/etcd
bitnamicharts/postgresql
bitnamicharts/harbor
bitnamicharts/milvus
更多相关 Docker 镜像与资源
以下是 bitnamicharts/rabbitmq 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 rabbitmq 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务