k8s快速部署rocketMq及rocketMq-console-ng

一、部署rocketMq

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rocketmq-broker
  name: rocketmq-broker
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rocketmq-broker
  template:
    metadata:
      labels:
        app: rocketmq-broker
    spec:
      containers:
      - env:
        - name: NAMESRV_ADDR     #通过环境变量指定namesrv 地址,注意该值为namesrv svc地址
          value: rocketmq-dialevoneid:9876
        image: rocketmqinc/rocketmq:4.4.0
command: ["/bin/sh","mqbroker"]
name: rocketmq-broker ports: - containerPort: 10909 name: tcp-10909 protocol: TCP - containerPort: 10911 name: tcp-10911 protocol: TCP - containerPort: 10912 name: tcp-10912 protocol: TCP resources: limits: memory: 1200Mi requests: memory: 1200Mi

2.namesrv

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rocketmq-namesrv
  name: rocketmq-namesrv
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rocketmq-namesrv
  template:
    metadata:
      labels:
        app: rocketmq-namesrv
    spec:
      containers:
      - image: rocketmqinc/rocketmq:4.4.0
name: rockermq-namesrv
command: ["/bin/sh","mqnamesrv"] ports:
- containerPort: 9876 name: tcp-9876 protocol: TCP resources: limits: memory: 600Mi requests: memory: 600Mi

3.console

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rocketmq-dashboard
  name: rocketmq-dashboard
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rocketmq-dashboard
  template:
    metadata:
      labels:
        app: rocketmq-dashboard
    spec:
      containers:
      - env:
        - name: JAVA_OPTS
          value: -Drocketmq.namesrv.addr=rocketmq-dialevoneid:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false   #注意替换此处namesrv svc的名称
        image: styletang/rocketmq-console-ng
        name: rocketmq-dashboard

4.rocketMq namesrv svc

apiVersion: v1
kind: Service
metadata:
  labels:
    app: rocketmq-dialevoneid
  name: rocketmq-dialevoneid
  namespace: default
spec:
  ports:
  - name: tcp-9876
    port: 9876
    protocol: TCP
    targetPort: 9876
  selector:
    app: rocketmq-namesrv

5.rocketMq console svc

apiVersion: v1
kind: Service
metadata:
  labels:
    app: rocketmq-dashboard
  name: rocketmq-dashboard
  namespace: default
spec:
  ports:
  - port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: rocketmq-dashboard

6.rocketMq console ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-rocketmq
  namespace: default
spec:
  rules:
  - host: rocketmq.xxxx.com
    http:
      paths:
      - backend:
          service:
            name: rocketmq-dashboard
            port:
              number: 8080
        path: /
        pathType: ImplementationSpecific

7.注意事项

日志、 消息存储目录 rocket namesrv配置等目录建议使用持久化存储,其他注意替换对应的svc名称 名称空间,镜像默认存储在用户家目录下,可以通过配置文件修改

 

posted @ 2023-04-21 15:43  百衲本  阅读(1579)  评论(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; } 回到顶部 博客侧边栏 回到顶部 页首代码 回到顶部 页脚代码