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

有问题和意见请留言

相关推荐
景天科技苑13 分钟前
【云原生开发】K8S多集群资源管理平台架构设计
云原生·容器·kubernetes·k8s·云原生开发·k8s管理系统
wclass-zhengge1 小时前
K8S篇(基本介绍)
云原生·容器·kubernetes
颜淡慕潇1 小时前
【K8S问题系列 |1 】Kubernetes 中 NodePort 类型的 Service 无法访问【已解决】
后端·云原生·容器·kubernetes·问题解决
昌sit!9 小时前
K8S node节点没有相应的pod镜像运行故障处理办法
云原生·容器·kubernetes
A ?Charis12 小时前
Gitlab-runner running on Kubernetes - hostAliases
容器·kubernetes·gitlab
北漂IT民工_程序员_ZG13 小时前
k8s集群安装(minikube)
云原生·容器·kubernetes
2301_8061313619 小时前
Kubernetes的基本构建块和最小可调度单元pod-0
云原生·容器·kubernetes
SilentCodeY20 小时前
containerd配置私有仓库registry
容器·kubernetes·containerd·镜像·crictl
binqian1 天前
【k8s】ClusterIP能http访问,但是不能ping 的原因
http·容器·kubernetes
探索云原生1 天前
GPU 环境搭建指南:如何在裸机、Docker、K8s 等环境中使用 GPU
ai·云原生·kubernetes·go·gpu