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

有问题和意见请留言

相关推荐
条纹布鲁斯7 小时前
dockerdsktop修改安装路径/k8s部署wordpress和ubuntu
docker·kubernetes
登云时刻10 小时前
Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(一)
redis·kubernetes·bootstrap
吴半杯11 小时前
gateway漏洞(CVE-2022-22947)
docker·kubernetes·gateway
灼烧的疯狂15 小时前
K8S + Jenkins 做CICD
容器·kubernetes·jenkins
wenyue112116 小时前
Revolutionize Your Kubernetes Experience with Easegress: Kubernetes Gateway API
容器·kubernetes·gateway
Python私教19 小时前
ubuntu搭建k8s环境详细教程
linux·ubuntu·kubernetes
O&REO20 小时前
单机部署kubernetes环境下Overleaf-基于MicroK8s的Overleaf应用部署指南
云原生·容器·kubernetes
politeboy20 小时前
k8s启动springboot容器的时候,显示找不到application.yml文件
java·spring boot·kubernetes
运维小文21 小时前
K8S资源限制之LimitRange
云原生·容器·kubernetes·k8s资源限制
登云时刻21 小时前
Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(二)
redis·容器·kubernetes