1.添加rabbitmq仓库并下载包
helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/rabbitmq --version 10.1.4
tar -zxvf rabbitmq-10.1.4.tgz
mv values.yaml values.yaml.back
grep -v "#" values.yaml.back > values.yaml
2.helm部署服务与默认rabbitmq/values.yaml修改
可以修改rabbitmq指定版本
image:
registry: docker.io
repository: bitnami/rabbitmq
tag: 3.10.5-debian-10-r0
如果不挂载持久化磁盘可修改persistence 为false
persistence:
enabled: false
storageClass: ""
selector: {}
accessModes:
- ReadWriteOnce
existingClaim: ""
mountPath: /bitnami/rabbitmq/mnesia
subPath: ""
size: 8Gi
annotations: {}
如果要暴露端口可修改service配置type: NodePort,可以自己指定暴露的端口
service:
type: NodePort
portEnabled: true
distPortEnabled: true
managerPortEnabled: true
epmdPortEnabled: true
ports:
amqp: 5672
amqpTls: 5671
dist: 25672
manager: 15672
metrics: 9419
epmd: 4369
portNames:
amqp: "amqp"
amqpTls: "amqp-ssl"
dist: "dist"
manager: "http-stats"
metrics: "metrics"
epmd: "epmd"
nodePorts:
amqp: "31672"
amqpTls: "31671"
dist: "31673"
manager: "31674"
epmd: "31419"
metrics: "31369"
部署服务
helm install my-rabbitmq rabbitmq -n default
3.helm持久指定服务器和持久化挂载部署
pvc创建
tee ci/default/rabbitmq-data-local-path-values.yaml <<EOF
nameOverride: rabbitmq-data-local-path
size: 1Gi
storageClassName: local-path
EOF
helm upgrade rabbitmq-data-local-path ./pvc/ -f ./pvc/ci/ci-values.yaml -f ./pvc/ci/default/rabbitmq-data-local-path-values.yaml -i -n default
kubectl label node gem-yxyw-t-c02 rabbitmq.default=true
tee ci/ci-values.yaml <<EOF
image:
registry: docker.io
repository: bitnami/rabbitmq
tag: 3.9
debug: false
pullPolicy: IfNotPresent
pullSecrets: []
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: rabbitmq.default
operator: In
values:
- "true"
persistence:
enabled: true
existingClaim: rabbitmq-data-local-path
service:
enabled: true
type: NodePort
EOF
启动服务
helm upgrade rabbitmq ./rabbitmq/ -f ./rabbitmq/values.yaml -f ./rabbitmq/ci/ci-values.yaml -i -n default
创建rabbitmq用户
设置登录访问权限