Define Cluster_name via k8s env var #13094
-
Community Support Policy
RabbitMQ version used4.0.4 Erlang version used26.2.x Operating system (distribution) usedAlpine How is RabbitMQ deployed?Community Docker image rabbitmq-diagnostics status outputSee https://www.rabbitmq.com/docs/cli to learn how to use rabbitmq-diagnostics
Logs from node 1 (with sensitive values edited out)See https://www.rabbitmq.com/docs/logging to learn how to collect logs
Logs from node 2 (if applicable, with sensitive values edited out)See https://www.rabbitmq.com/docs/logging to learn how to collect logs
Logs from node 3 (if applicable, with sensitive values edited out)See https://www.rabbitmq.com/docs/logging to learn how to collect logs
rabbitmq.confSee https://www.rabbitmq.com/docs/configure#config-location to learn how to find rabbitmq.conf file location
Steps to deploy RabbitMQ clusterDeploying via sts in k8s , i tried alot of diff methods but none some to go into the rabbitmq conf, i looked up the docs regarding this,but couldt find anything related to this Steps to reproduce the behavior in questionDeploying via sts in k8s , i tried alot of diff methods but none some to go into the rabbitmq conf, i looked up the docs regarding this,but couldt find anything related to this advanced.configSee https://www.rabbitmq.com/docs/configure#config-location to learn how to find advanced.config file location
Application code# PASTE CODE HERE, BETWEEN BACKTICKS Kubernetes deployment file# Relevant parts of K8S deployment that demonstrate how RabbitMQ is deployed
# PASTE YAML HERE, BETWEEN BACKTICKS What problem are you trying to solve?Trying to define cluster_name via env var, but i cant seem ti find the correct env-var that defines this, and nothing in docs around this, could be that it is just not possible |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Indeed, I don't think there's an environment variable for the cluster name. Why would you want to do this this specifically through an environment variable? A few years ago we decided to go in the opposite direction and reduce the number of env variables, since reasoning about the effective cluster configuration when there are env variables, config file, advanced config file and command line flags was hard. The recommended way of deploying to Kubernetes is by using the operator: https://www.rabbitmq.com/kubernetes/operator/using-operator It sets the name by default so that it matched the name of the resource. If you want a different name, add:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for fast response! So our use-case might be a bit edge we have 3 dev envs in our k8s cluster and a seperate prod cluster
each have a seperate rabbitmq cluster, we then utilize git for a single-source of truth regarding config/image version and push those via argoCD, and for defineing seperate env specefic configs we use kustomize , so overlay for each env i prefer to keep it as vanilla as possible and define our own manifest and not use any crd/operators nor helm-charts but kustomize for now i solved it like this but could be nice to just use a env var and not force it into it via init container, but probally more a nice to have than need :) ! this way we can configoure general configs in the base of the configmap, and for env specific settings we define it in the overlays hope my setup makes sense |
Beta Was this translation helpful? Give feedback.
RabbitMQ supports conf.d configuration style (with multiple config files, loaded in the order they are listed), so you can have the shared config file mounted as, for example,
/etc/rabbitmq/conf.d/10-generic.conf
and then a per-environment config file mounted as/etc/rabbitmq/conf.d/20-env.config
, etc. (configuration in the file loaded later will override whatever was set before for the same configuration option)