docker
docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 swr.cn-east-3.myhuaweicloud.com/lomtom-common/rabbitmq:3.8.23-management
k8s(单节点)
---
kind: Secret
apiVersion: v1
metadata:
name: rabbitmq-secret
data:
pass: R3JnQDIwMjI=
user: YWRtaW4=
type: Opaque
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rabbitmq
labels:
app: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
creationTimestamp: null
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: 'rabbitmq:3.8.23-management'
ports:
- name: tcp-5672
containerPort: 5672
protocol: TCP
- name: http-15672
containerPort: 15672
protocol: TCP
env:
- name: RABBITMQ_DEFAULT_USER
valueFrom:
secretKeyRef:
name: rabbitmq-secret
key: user
- name: RABBITMQ_DEFAULT_PASS
valueFrom:
secretKeyRef:
name: rabbitmq-secret
key: pass
resources:
limits:
cpu: '2'
memory: 4000Mi
requests:
cpu: 100m
memory: 500Mi
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq-external
labels:
app: rabbitmq-external
spec:
ports:
- name: http-rabbitmq-5672
protocol: TCP
port: 5672
targetPort: 5672
- name: http-rabbitmq-external
protocol: TCP
port: 15672
targetPort: 15672
selector:
app: rabbitmq
type: NodePort