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

主从配置直通车

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

amqmaster.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

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

有问题和意见请留言

相关推荐

  1. K8S部署MySQL主从环境

    2024-04-02 06:38:03       13 阅读
  2. k8s有状态部署mysql主从(local pv持久化)

    2024-04-02 06:38:03       26 阅读
  3. kubekey部署k8s

    2024-04-02 06:38:03       27 阅读

最近更新

  1. Kubernetes Kafka 系列|MirrorMaker 2 同步数据

    2024-04-02 06:38:03       0 阅读
  2. android 内存优化

    2024-04-02 06:38:03       0 阅读
  3. oracle控制文件的管理

    2024-04-02 06:38:03       0 阅读
  4. el-table 表格从下往上滚动,触底自动请求新数据

    2024-04-02 06:38:03       0 阅读
  5. jQuery高级使用

    2024-04-02 06:38:03       0 阅读

热门阅读

  1. 禁止软件访问外网

    2024-04-02 06:38:03       3 阅读
  2. Git简介

    Git简介

    2024-04-02 06:38:03      2 阅读
  3. kafka面试常见问题

    2024-04-02 06:38:03       6 阅读
  4. redis -List

    2024-04-02 06:38:03       6 阅读
  5. 数据库设计-MySQL设计小册

    2024-04-02 06:38:03       4 阅读