- k8s版本1.21.1
- rabbitmq 3.8.19
- cluster 1.9
1.安装rabbitmq的cluster
rabbitmq的cluster模式为vmware开源维护:https://github.com/rabbitmq/cluster-operator
kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"
2. 安装rabbitmq
官方配置详解https://www.rabbitmq.com/kubernetes/operator/using-operator.html#override 官方demo在https://github.com/rabbitmq/cluster-operator/tree/main/docs/examples/production-ready
vim rabbitmq.yaml
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
labels:
app: rabbitmq
name: rabbitmq
namespace: rabbitmq-system
spec:
image: rabbitmq:3.8.19-management
service:
type: NodePort
persistence:
storage: 5Gi
storageClassName: managed-nfs-storage
replicas: 3
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 200m
memory: 200Mi
rabbitmq:
additionalConfig: |
cluster_partition_handling = pause_minority
vm_memory_high_watermark_paging_ratio = 0.99
disk_free_limit.relative = 1.0
collect_statistics_interval = 10000
additionalPlugins:
- rabbitmq_top
terminationGracePeriodSeconds: 60
获取登录用户名和密码
kubectl -n rabbitmq-system get secret rabbitmq-default-user -o jsonpath="{.data.username}" | base64 --decode
kubectl -n rabbitmq-system get secret rabbitmq-default-user -o jsonpath="{.data.password}" | base64 --decode
|