本文提供了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
有问题和意见请留言