apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: rabbitmq
spec:
  serviceName: rabbitmq
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
        - name: rabbitmq
          image: rabbitmq:3.8.3-management
          ports:
            - name: http
              protocol: TCP
              containerPort: 15672
            - name: amqp
              protocol: TCP
              containerPort: 5672
          livenessProbe:
            exec:
              command:
                - "rabbitmq-diagnostics"
                - "ping"
            initialDelaySeconds: 10
            periodSeconds: 30
            timeoutSeconds: 15
          readinessProbe:
            exec:
              command:
                - "rabbitmq-diagnostics"
                - "check_port_connectivity"
            initialDelaySeconds: 10
            periodSeconds: 30
            timeoutSeconds: 15
