1.获取yaml
1 |
git clone https://gitee.com/salmon_163/k8s-rocketmq.git |
2.打镜像:
1 2 3 4 5 6 7 8 9 10 11 |
1.进入/rocketmq-k8s/rocketmq-base/ 运行 docker build -t registry.cn-shanghai.aliyuncs.com/shooer/rocketmq-base:4.5.1 . docker push registry.cn-shanghai.aliyuncs.com/shooer/rocketmq-base:4.5.1 2.进入/rocketmq-k8s/rocketmq-namesrv/ 运行 docker build -t registry.cn-shanghai.aliyuncs.com/shooer/rocketmq-namesrv:4.5.1 . docker push registry.cn-shanghai.aliyuncs.com/shooer/rocketmq-namesrv:4.5.1 3.进入/rocketmq-k8s/rocketmq-broker/ 运行 docker build -t registry.cn-shanghai.aliyuncs.com/shooer/rocketmq-broker:4.5.1 . docker push registry.cn-shanghai.aliyuncs.com/shooer/rocketmq-broker:4.5.1 |
3.创建ns,并给节点添加标签,用来约束rocketmq节点分布
1 2 3 |
kubectl apply -f rocketmq-namespace.yaml #创建ns kubectl label nodes k8s-node-01 node-role.kubernetes.io/rocketmq=true kubectl label nodes k8s-node-02 node-role.kubernetes.io/rocketmq=true |
3.1 创建imagePullSecrets
1 2 3 4 5 |
kubectl create secret docker-registry rocketmq-secret-key -n rocketmq \ --docker-server=registry.cn-shanghai.aliyuncs.com \ --docker-username=xxxxxx \ --docker-password=xxxxxx \ --docker-email=xxxxx@163.com |
4.执行yaml创建
4.1、创建namesrv
1 |
kubectl create -f rocketmq-namesrv-prod.yaml |
4.2、创建 broker
1 2 |
kubectl create -f rocketmq-broker-master-prod.yaml kubectl create -f rocketmq-broker-slave-prod.yaml |
4.3、创建访问控制台console + ingress对外访问
1 |
kubectl create -f rocketmq-console-ng-prod-ingress.yaml |
部署完成
1 2 3 4 5 |
注意:如果想只在某个节点上访问console,可以使用externalIp kubectl create -f rocketmq-console-ng-prod-externalIp.yaml 本人自用yaml https://gitee.com/byshooter/shooter/tree/master/rocketmq |
- 本文固定链接: https://www.yoyoask.com/?p=6844
- 转载请注明: shooter 于 SHOOTER 发表