kubernetes 部署 ActiveMQ集群版yaml文件
时间: 2023-08-03 21:06:17 浏览: 139
以下是部署 ActiveMQ 集群版的 YAML 文件示例:
StatefulSet:
```
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: artemis
spec:
replicas: 3
selector:
matchLabels:
app: artemis
serviceName: artemis-headless
template:
metadata:
labels:
app: artemis
spec:
containers:
- name: artemis
image: apache/artemis:2.17.0
ports:
- containerPort: 61616
- containerPort: 8161
volumeMounts:
- name: artemis-data
mountPath: /var/lib/artemis/data
volumes:
- name: artemis-data
persistentVolumeClaim:
claimName: artemis-data
volumeClaimTemplates:
- metadata:
name: artemis-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
```
Headless Service:
```
apiVersion: v1
kind: Service
metadata:
name: artemis-headless
labels:
app: artemis
spec:
clusterIP: None
selector:
app: artemis
ports:
- name: tcp
port: 61616
targetPort: 61616
- name: web
port: 8161
targetPort: 8161
```
LoadBalancer Service:
```
apiVersion: v1
kind: Service
metadata:
name: artemis-loadbalancer
labels:
app: artemis
spec:
type: LoadBalancer
selector:
app: artemis
ports:
- name: tcp
port: 61616
targetPort: 61616
- name: web
port: 8161
targetPort: 8161
```
你可以将这些 YAML 文件保存为单独的文件,然后使用 kubectl apply 命令来部署它们:
```
kubectl apply -f statefulset.yaml
kubectl apply -f headless-service.yaml
kubectl apply -f loadbalancer-service.yaml
```
注意,这里使用的是 Apache ActiveMQ Artemis,而不是 Apache ActiveMQ。如果你想要部署 Apache ActiveMQ,可以使用类似的方式进行部署,但是需要相应地更改 YAML 文件中的镜像名称和端口号。
阅读全文