Kubernetes activemq artemis系列 | k8s部署artemis主从 v2.33.0

主从配置直通车

本文提供了yaml可直接使用(镜像是自己构建的)

amqmaster.yaml

yaml 复制代码
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: artemismaster
  labels:
    app: artemis
    broker: master
spec:
  serviceName: artemismaster
  replicas: 1
  selector:
    matchLabels:
      app: artemis
      broker: master
  template:
    metadata:
      labels:
        app: artemis
        broker: master
    spec:
      nodeName: k8s-node1
      containers:
        - name: artemis
          image: zhaoguanghui6/activemq-artemis:2.33-master
          command: ["bash","-ce","/root/artemis/bin/broker/bin/artemis run"]
          ports:
            - containerPort: 61616
              name: tcp
            - containerPort: 8161
              name: web
            - containerPort: 1883
              name: mqtt
---
apiVersion: v1
kind: Service
metadata:
  name: master-service-nodeport
  labels:
    app: artemis
    broker: master
spec:
  type: NodePort  
  ports:
  - port: 61616
    targetPort: tcp
    name: tcp
    nodePort: 30000 
  - port: 8161
    targetPort: web
    name: web
    nodePort: 30001 
  - port: 1883
    targetPort: mqtt
    name: mqtt
    nodePort: 30002  
  selector:
    app: artemis
    broker: master

---
apiVersion: v1
kind: Service
metadata:
  name: artemismaster
  labels:
    app: artemis
    broker: master
spec:
  ports:
  - port: 61616
    targetPort: tcp
    name: tcp
  - port: 8161
    targetPort: web
    name: web
  - port: 1883
    targetPort: mqtt
    name: mqtt
  selector:
    app: artemis
    broker: master

amqslave.yaml

yaml 复制代码
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: artemisslave
  labels:
    app: artemis
    broker: slave
spec:
  serviceName: artemisslave
  replicas: 1
  selector:
    matchLabels:
      app: artemis
      broker: slave
  template:
    metadata:
      labels:
        app: artemis
        broker: slave
    spec:
      nodeName: k8s-node1
      containers:
        - name: artemis
          image: zhaoguanghui6/activemq-artemis:2.33-slave
          command: ["bash","-ce","/root/artemis/bin/broker/bin/artemis run"]
          ports:
            - containerPort: 61616
              name: tcp
            - containerPort: 8161
              name: web
            - containerPort: 1883
              name: mqtt
---
apiVersion: v1
kind: Service
metadata:
  name: slave-service-nodeport
  labels:
    app: artemis
    broker: slave
spec:
  type: NodePort  
  ports:
  - port: 61616
    targetPort: tcp
    name: tcp
    nodePort: 30003  
  - port: 8161
    targetPort: web
    name: web
    nodePort: 30004 
  - port: 1883
    targetPort: mqtt
    name: mqtt
    nodePort: 30005 
  selector:
    app: artemis
    broker: slave

---
apiVersion: v1
kind: Service
metadata:
  name: artemisslave
  labels:
    app: artemis
    broker: slave
spec:
  ports:
  - port: 61616
    targetPort: tcp
    name: tcp
  - port: 8161
    targetPort: web
    name: web
  - port: 1883
    targetPort: mqtt
    name: mqtt
  selector:
    app: artemis
    broker: slave

有问题和意见请留言

相关推荐
元气满满的热码式14 小时前
K8S中Service详解(三)
云原生·容器·kubernetes
周杰伦_Jay20 小时前
详细介绍:Kubernetes(K8s)的技术架构(核心概念、调度和资源管理、安全性、持续集成与持续部署、网络和服务发现)
网络·ci/cd·架构·kubernetes·服务发现·ai编程
周杰伦_Jay1 天前
详细介绍:云原生技术细节(关键组成部分、优势和挑战、常用云原生工具)
java·云原生·容器·架构·kubernetes·jenkins·devops
元气满满的热码式1 天前
K8S中Pod控制器之DaemonSet(DS)控制器
云原生·容器·kubernetes
夏子曦1 天前
k8s 蓝绿发布、滚动发布、灰度发布
云原生·容器·kubernetes
颜淡慕潇1 天前
【K8S系列】在 K8S 中使用 Values 文件定制不同环境下的应用配置
云原生·容器·kubernetes·环境配置
旦沐已成舟1 天前
K8S-Pod的环境变量,重启策略,数据持久化,资源限制
java·docker·kubernetes
github_czy1 天前
(k8s)k8s部署mysql与redis(无坑版)
redis·容器·kubernetes
超级阿飞1 天前
利用Kubespray安装生产环境的k8s集群-实施篇
elasticsearch·容器·kubernetes
来恩10031 天前
Kubernetes学习指南与资料分享
云原生·容器·kubernetes