Sangil's blog

https://github.com/ChoiSangIl Admin

쿠버네티스k8s rabbitMq 설정하기 DEV / DOCKER

2020-04-13 posted by sang12


rabbitmq-stateful.yaml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: rabbitmq
spec:
  replicas: 1
  serviceName: rabbitmq
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:3-management
        env:
        - name: RABBITMQ_ERLANG_COOKIE
          value: "1WqgH8N2v1qDBDZDbNy8Bg9IkPWLEpu79m6q+0t36lQ="
        volumeMounts:
        - mountPath: /var/lib/rabbitmq
          name: rabbitmq-data
      volumes:
        - name: rabbitmq-data
          hostPath:
            path: /data/rabbitmq
            type: DirectoryOrCreate
    

rabbitmq-svc.yml

apiVersion: v1
kind: Service
metadata:
  # Expose the management HTTP port on each node
  name: rabbitmq-management
  labels:
    app: rabbitmq
spec:
  selector:
    app: rabbitmq
  ports:
  - port: 9997
    name: http
    targetPort: 15672
  externalIPs:
    - {yourIp}
  type: LoadBalancer # Or LoadBalancer in production w/ proper security
---
apiVersion: v1
kind: Service
metadata:
  # The required headless service for StatefulSets
  name: rabbitmq
  labels:
    app: rabbitmq
spec:
  ports:
  - port: 5672
    name: amqp
    targetPort: 5672
  - port: 4369
    name: epmd
  - port: 25672
    name: rabbitmq-dist
  externalIPs:
   - {yourIp}
  selector:
    app: rabbitmq
  type: ClusterIP
    
#쿠버네티스 rabbitMQ #kube rabbitmq #rabbitmq 설정
REPLY