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

有问题和意见请留言

相关推荐
dessler2 小时前
Kubernetes(k8s)-Reloader介绍&使用
linux·运维·kubernetes
weixin_425878232 小时前
k8s 自动伸缩的场景与工作原理
java·容器·kubernetes
lzz的编码时刻2 小时前
K8s私有仓库拉取镜像报错解决:x509 certificate signed by unknown authority
云原生·容器·kubernetes
{⌐■_■}6 小时前
【Kubernetes】RBAC(基于角色的访问控制)如何设置?如何管理 Kubernetes 的权限?
云原生·容器·kubernetes
rider1899 小时前
【7】搭建k8s集群系列(二进制部署)-master节点之配置kubectl客户端证书
云原生·容器·kubernetes
yangjiajia1234569 小时前
k8s patch方法更新deployment和replace方法更新deployment的区别是什么
云原生·容器·kubernetes
Hurry69 小时前
k8s的pod的概述和配置
云原生·容器·kubernetes
alden_ygq9 小时前
k8s pod重启顺序说明
云原生·容器·kubernetes
Hurry610 小时前
Pod的调度
云原生·容器·kubernetes·pod的调度
敲键盘的小夜猫10 小时前
消息中间件对比与选型指南:Kafka、ActiveMQ、RabbitMQ与RocketMQ
kafka·rabbitmq·activemq