Changed RabbitMQ to a statfulset

This commit is contained in:
2026-03-05 09:22:04 +01:00
parent 2fb49f18d0
commit 6294747308
4 changed files with 37 additions and 42 deletions

View File

@@ -1,28 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
namespace: app-notifications
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3.11-management
ports:
- containerPort: 5672
- containerPort: 15672
volumeMounts:
- name: rabbitmq-data
mountPath: /var/lib/rabbitmq
volumes:
- name: rabbitmq-data
persistentVolumeClaim:
claimName: rabbitmq-pvc

View File

@@ -1,11 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rabbitmq-pvc
namespace: app-notifications
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -4,6 +4,8 @@ metadata:
name: rabbitmq name: rabbitmq
namespace: app-notifications namespace: app-notifications
spec: spec:
selector:
app: rabbitmq
ports: ports:
- port: 5672 - port: 5672
targetPort: 5672 targetPort: 5672
@@ -13,6 +15,4 @@ spec:
targetPort: 15672 targetPort: 15672
protocol: TCP protocol: TCP
name: management name: management
selector: clusterIP: None
app: rabbitmq
type: ClusterIP

34
rabbitmq/statefulset.yaml Normal file
View File

@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rabbitmq
namespace: app-notifications
spec:
serviceName: rabbitmq
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3.11-management
ports:
- containerPort: 5672
- containerPort: 15672
volumeMounts:
- name: rabbitmq-data
mountPath: /var/lib/rabbitmq
volumeClaimTemplates:
- metadata:
name: rabbitmq-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi