k8s安装rabbbitmq

1.创建rabbitmq pvc文件

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: rabbitmq-data
  namespace: t1-zdbl
spec:
  storageClassName: nfs-client #如果使用存储类自行替换,不是按具体情况配置
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10G

2.创建rabbitmq 部署文件

apiVersion: apps/v1
kind: Deployment
metadata:
  name: t1-zdbl-rabbitmq
  namespace: t1-zdbl
spec:
  selector:
    matchLabels:
      app: t1-zdbl-rabbitmq
  template:
    metadata:
      labels:
        app: t1-zdbl-rabbitmq
    spec:
      containers:
      - name: t1-zdbl-rabbitmq
        image: rabbitmq:3.8.16-management # management表示带web界面
        ports:
          - name: tcp-5672
            containerPort: 5672
            protocol: TCP
          - name: http-15672
            containerPort: 15672
            protocol: TCP
        env:
          - name: RABBITMQ_DEFAULT_USER  #创建管理员
            value: "admin"
          - name: RABBITMQ_DEFAULT_PASS
            value: "System@123"
        volumeMounts:
        - name: rabbitmq-persistent-storage
          mountPath: /var/lib/rabbitmq
      volumes:
      - name: rabbitmq-persistent-storage
        persistentVolumeClaim:
          claimName: rabbitmq-data

3.创建rabbitmq svc

apiVersion: v1
kind: Service
metadata:
  name: t1-zdbl-rabbitmq
  namespace: t1-zdbl
  labels:
    app: t1-zdbl-rabbitmq
spec:
  type: NodePort
  ports:
    - name: tcp-rabbitmq-5672
      protocol: TCP
      port: 5672
      targetPort: 5672
    - name: tcp-rabbitmq-15672
      protocol: TCP
      port: 15672
      targetPort: 15672
      nodePort: 31672
  selector:
    app: t1-zdbl-rabbitmq

应用以上文件即可

posted @ 2024-04-17 16:40  百衲本  阅读(204)  评论(0编辑  收藏  举报
cnblogs_post_body { color: black; font: 0.875em/1.5em "微软雅黑" , "PTSans" , "Arial" ,sans-serif; font-size: 15px; } cnblogs_post_body h1 { text-align:center; background: #333366; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 23px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } cnblogs_post_body h2 { text-align:center; background: #006699; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 20px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } cnblogs_post_body h3 { background: #2B6695; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 18px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } 回到顶部 博客侧边栏 回到顶部 页首代码 回到顶部 页脚代码