您的位置:首页 > 游戏 > 游戏 > k8s+RabbitMQ单机部署

k8s+RabbitMQ单机部署

2024/12/23 12:16:16 来源:https://blog.csdn.net/xiaogg3678/article/details/139653477  浏览:    关键词:k8s+RabbitMQ单机部署

1 k8s 配置文件yaml:

apiVersion: apps/v1
kind: Deployment
metadata:name: rabbitmq-deploynamespace: rz-dt
spec:replicas: 1selector:matchLabels:app: rabbitmqtemplate:metadata:labels:app: rabbitmqspec:containers:- name: rabbitmqimage: "rz-dt-image-server-registry-vpc.cn-shanghai.cr.aliyuncs.com/rz-dt-real/rabbitmq:3.6.15-management"imagePullPolicy: IfNotPresent #pull镜像时机,ports:- name: amqpcontainerPort: 5672- name: http-apicontainerPort: 15672imagePullSecrets:- name: rz-dt-miyue     
---
apiVersion: v1
kind: Service
metadata:name: rabbitmq-servicenamespace: rz-dt
spec:ports:- name: amqpnodePort: 30671port: 5672protocol: TCPtargetPort: 5672- name: http-apinodePort: 30672port: 15672protocol: TCPtargetPort: 15672selector:app: rabbitmqsessionAffinity: Nonetype: NodePort

2 Dockerfile

(也可以手动拉取,上传镜像仓库,如下 )

docker pull  rabbitmq:3.6.15-managementdocker tag rabbitmq:3.6.15-management rz-dt-image-server-registry-vpc.cn-shanghai.cr.aliyuncs.com/rz-dt-real/rabbitmq:3.6.15-managementdocker push rz-dt-image-server-registry-vpc.cn-shanghai.cr.aliyuncs.com/rz-dt-real/rabbitmq:3.6.15-management
FROM rabbitmq:3.6.15-management

3 k8s 执行命令:

kubectl --kubeconfig ~/.kube-rz-real/config apply -f rabbitmq-service.yaml

访问地址 http://ip:30672 ,账号guest/guest

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com