【云原生 | Kubernetes 系列】— k8s-helm 部署rabbitmq集群
版权 本文为云录原创文章,转载无需和我联系,但请注明来自云录 https://www.yunzhuan.site
Helm帮助您管理 Kubernetes 应用程序——Helm Charts 帮助您定义、安装和升级最复杂的 Kubernetes 应用程序。 Helm 可以使用 Charts 启动 Kubernetes 集群
🍇 helm安装
官方文档:https://helm.sh/docs/intro/install/
版本下载地址:https://github.com/helm/helm/releases
🍋 安装rabbitmqCluster
一:helm仓库配置
helm repo add stable http://mirror.azure.cn/kubernetes/charts
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo add apphub https://apphub.aliyuncs.com
二:查看可用仓库
[root rabbitmq-ha]# helm repo list
NAME URL
aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
bitnami https://charts.bitnami.com/bitnami
stable http://mirror.azure.cn/kubernetes/charts
三:搜索可用rabbitmq-ha
[root rabbitmq-ha]# helm search repo rabbitmq
NAME CHART VERSION APP VERSION DESCRIPTION
aliyun/rabbitmq 0.6.21 3.7.3 Open source message broker software that implem...
aliyun/rabbitmq-ha 1.0.0 3.7.3 Highly available RabbitMQ cluster, the open sou...
bitnami/rabbitmq 11.12.0 3.11.11 RabbitMQ is an open source general-purpose mess...
bitnami/rabbitmq-cluster-operator 3.2.8 2.2.0 The RabbitMQ Cluster Kubernetes Operator automa...
stable/prometheus-rabbitmq-exporter 0.5.6 v0.29.0 DEPRECATED Rabbitmq metrics exporter for promet...
stable/rabbitmq 6.18.2 3.8.2 DEPRECATED Open source message broker software ...
stable/rabbitmq-ha 1.47.1 3.8.7 DEPRECATED - Highly available RabbitMQ cluster,...
四:选择rabbitmq-ha安装
1:拉取仓库
helm pull stable/rabbitmq-ha
[root@ rabbitmq]# ll
-rw-r--r-- 1 root root 20031 Mar 30 10:44 rabbitmq-ha-1.47.1.tgz
[root@ rabbitmq]# tar -zxvf rabbitmq-ha-1.47.1.tgz
[root@ rabbitmq]# ll
drwxr-xr-x 4 root root 4096 Mar 30 10:44 rabbitmq-ha
-rw-r--r-- 1 root root 20031 Mar 30 10:44 rabbitmq-ha-1.47.1.tgz
[root@ rabbitmq]# cd rabbitmq-ha/
[root@ rabbitmq-ha]# ll
-rwxr-xr-x 1 root root 520 Jan 1 1970 Chart.yaml
drwxr-xr-x 2 root root 4096 Mar 30 10:44 ci
-rwxr-xr-x 1 root root 59 Jan 1 1970 OWNERS
-rwxr-xr-x 1 root root 53480 Jan 1 1970 README.md
drwxr-xr-x 2 root root 4096 Mar 30 10:44 templates
-rwxr-xr-x 1 root root 16515 Jan 1 1970 values.yaml
2:修改values.yaml
#账号密码
rabbitmqUsername: guest
rabbitmqPassword: guest
#设置内存大小
rabbitmqMemoryHighWatermark: 6144MB
#设置访问方式,这里采用nodeport
service:
type: NodePort
#端口自己设置
epmdNodePort: 30537
amqpNodePort: 32694
managerNodePort: 30672
#存储我这里使用storageClass
persistentVolume:
enabled: true
#这里改成自己的SC
storageClass: "alicloud-disk"
size: 20Gi
3:运行rabbitmq集群
[root@ rabbitmq-ha]# kubectl create ns rmq
namespace/rmq created
[root@ rabbitmq-ha]# helm install rq . -n rmq
WARNING: This chart is deprecated
NAME: rq
LAST DEPLOYED: Thu Mar 30 11:01:23 2023
NAMESPACE: rmq
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
*******************
*** DEPRECATED ****
*******************
This chart is deprecated and no longer maintained. It is recommended to use the Bitnami
maintained RabbitMQ chart (https://github.com/bitnami/charts/tree/master/bitnami/rabbitmq)
which has a similar feature set, including high availability.
** Please be patient while the chart is being deployed **
Credentials:
Username : guest
Password : $(kubectl get secret --namespace rmq rq-rabbitmq-ha -o jsonpath="{.data.rabbitmq-password}" | base64 --decode)
Management username : management
Management password : $(kubectl get secret --namespace rmq rq-rabbitmq-ha -o jsonpath="{.data.rabbitmq-management-password}" | base64 --decode)
ErLang Cookie : $(kubectl get secret --namespace rmq rq-rabbitmq-ha -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 --decode)
RabbitMQ can be accessed within the cluster on port 5672 at rq-rabbitmq-ha.rmq.svc.cluster.local
To access the cluster externally execute the following commands:
export NODE_IP=$(kubectl get nodes --namespace rmq -o jsonpath="{.items[0].status.addresses[?(@.type=='ExternalIP')].address}")
export NODE_PORT_AMQP=$(kubectl get --namespace rmq -o jsonpath='{.spec.ports[?(@.name=="amqp")].nodePort}' services rq-rabbitmq-ha)
export NODE_PORT_STATS=$(kubectl get --namespace rmq -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}' services rq-rabbitmq-ha)
To Access the RabbitMQ AMQP port:
amqp://$NODE_IP:$NODE_PORT_AMQP/
To Access the RabbitMQ Management interface:
http://$NODE_IP:$NODE_PORT_STATS/
4:查看是否启动完成
[root@ rabbitmq-ha]# kubectl get all -n rmq
NAME READY STATUS RESTARTS AGE
pod/rq-rabbitmq-ha-0 1/1 Running 0 91m
pod/rq-rabbitmq-ha-1 1/1 Running 0 90m
pod/rq-rabbitmq-ha-2 1/1 Running 0 89m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/rq-rabbitmq-ha NodePort 172.25.5.101 <none> 15672:30672/TCP,5672:32694/TCP,4369:30537/TCP 91m
service/rq-rabbitmq-ha-discovery ClusterIP None <none> 15672/TCP,5672/TCP,4369/TCP 91m
NAME READY AGE
statefulset.apps/rq-rabbitmq-ha 3/3 91m
5:访问集群 http://$NODE_IP:30672/
如果有什么问题,请联系作者 beicheng1892@163.com
版权 本文为云录原创文章,转载无需和我联系,但请注明来自云录 https://www.yunzhuan.site