rabbitmq容器化部署
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
labels:
app: rabbitmq
spec:
type: NodePort
ports:
- name: http
protocol: TCP
port: 15672
targetPort: 15672
nodePort: 30372
- name: amqp
protocol: TCP
port: 5672
targetPort: 5672
nodePort: 30272
- name: mqtts
protocol: TCP
port: 8883
targetPort: 8883
nodePort: 30883
selector:
app: rabbitmq
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rabbitmq
labels:
app: rabbitmq
spec:
replicas: 1
serviceName: rabbitmq
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3.8.15
imagePullPolicy: IfNotPresent
volumeMounts:
- name: rabbitmq-conf
mountPath: /etc/rabbitmq
- name: rabbitmq-data
mountPath: /var/lib/rabbitmq/mnesia
- name: rabbitmq-log
mountPath: /var/log/rabbitmq
restartPolicy: Always
volumes:
- name: rabbitmq-conf
hostPath:
path: /data/rabbitmq
- name: rabbitmq-data
hostPath:
path: /data/rabbitmq/mnesia
- name: rabbitmq-log
hostPath:
path: /data/rabbitmq/log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
上次更新: 2022/10/08, 16:35:41