1.创建rabbitmq pvc文件
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: rabbitmq-data namespace: t1-zdbl spec: storageClassName: nfs-client #如果使用存储类自行替换,不是按具体情况配置 accessModes: - ReadWriteMany resources: requests: storage: 10G
2.创建rabbitmq 部署文件
apiVersion: apps/v1 kind: Deployment metadata: name: t1-zdbl-rabbitmq namespace: t1-zdbl spec: selector: matchLabels: app: t1-zdbl-rabbitmq template: metadata: labels: app: t1-zdbl-rabbitmq spec: containers: - name: t1-zdbl-rabbitmq image: rabbitmq:3.8.16-management # management表示带web界面 ports: - name: tcp-5672 containerPort: 5672 protocol: TCP - name: http-15672 containerPort: 15672 protocol: TCP env: - name: RABBITMQ_DEFAULT_USER #创建管理员 value: "admin" - name: RABBITMQ_DEFAULT_PASS value: "System@123" volumeMounts: - name: rabbitmq-persistent-storage mountPath: /var/lib/rabbitmq volumes: - name: rabbitmq-persistent-storage persistentVolumeClaim: claimName: rabbitmq-data
3.创建rabbitmq svc
apiVersion: v1 kind: Service metadata: name: t1-zdbl-rabbitmq namespace: t1-zdbl labels: app: t1-zdbl-rabbitmq spec: type: NodePort ports: - name: tcp-rabbitmq-5672 protocol: TCP port: 5672 targetPort: 5672 - name: tcp-rabbitmq-15672 protocol: TCP port: 15672 targetPort: 15672 nodePort: 31672 selector: app: t1-zdbl-rabbitmq
应用以上文件即可
标签:name,15672,安装,rabbitmq,t1,5672,k8s,zdbl,rabbbitmq From: https://www.cnblogs.com/panwenbin-logs/p/18141137