k8s+RabbitMQ单机部署

1 k8s 配置文件yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq-deploy
  namespace: rz-dt
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: "rz-dt-image-server-registry-vpc.cn-shanghai.cr.aliyuncs.com/rz-dt-real/rabbitmq:3.6.15-management"
        imagePullPolicy: IfNotPresent #pull镜像时机,
        ports:
        - name: amqp
          containerPort: 5672
        - name: http-api
          containerPort: 15672
      imagePullSecrets:
        - name: rz-dt-miyue     
---
apiVersion: v1
kind: Service
metadata:
  name: rabbitmq-service
  namespace: rz-dt
spec:
  ports:
    - name: amqp
      nodePort: 30671
      port: 5672
      protocol: TCP
      targetPort: 5672
    - name: http-api
      nodePort: 30672
      port: 15672
      protocol: TCP
      targetPort: 15672
  selector:
    app: rabbitmq
  sessionAffinity: None
  type: NodePort

2 Dockerfile

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

docker pull  rabbitmq:3.6.15-management

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


docker 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

相关推荐
登云时刻29 分钟前
Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(一)
redis·kubernetes·bootstrap
吴半杯1 小时前
gateway漏洞(CVE-2022-22947)
docker·kubernetes·gateway
BestandW1shEs2 小时前
彻底理解消息队列的作用及如何选择
java·kafka·rabbitmq·rocketmq
Code_Artist4 小时前
使用Portainer来管理并编排Docker容器
docker·云原生·容器
Eternal-Student4 小时前
【docker 保存】将Docker镜像保存为一个离线的tar归档文件
运维·docker·容器
码农小丘4 小时前
一篇保姆式centos/ubuntu安装docker
运维·docker·容器
灼烧的疯狂6 小时前
K8S + Jenkins 做CICD
容器·kubernetes·jenkins
wenyue11217 小时前
Revolutionize Your Kubernetes Experience with Easegress: Kubernetes Gateway API
容器·kubernetes·gateway
Python私教9 小时前
ubuntu搭建k8s环境详细教程
linux·ubuntu·kubernetes
O&REO11 小时前
单机部署kubernetes环境下Overleaf-基于MicroK8s的Overleaf应用部署指南
云原生·容器·kubernetes