2022-02-24:k8s安装rabbitmq,yaml如何写?

Posted 福大大架构师每日一题

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2022-02-24:k8s安装rabbitmq,yaml如何写?相关的知识,希望对你有一定的参考价值。

2022-02-24:k8s安装rabbitmq,yaml如何写?

答案2022-02-24:

yaml如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rabbitmq
  name: rabbitmq
  namespace: moonfdd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
        - env:
            - name: RABBITMQ_DEFAULT_USER
              value: admin
            - name: RABBITMQ_DEFAULT_PASS
              value: moonfdd
          image: 'rabbitmq:management'
          imagePullPolicy: IfNotPresent
          name: rabbitmq
          volumeMounts:
            - mountPath: /var/lib/rabbitmq/
              name: data
      volumes:
        - name: data
          hostPath:
            path: /root/k8s/moonfdd/rabbitmq/var/lib/rabbitmq/
            type: DirectoryOrCreate
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: rabbitmq
  name: rabbitmq
  namespace: moonfdd
spec:
  ports:
    - name: 5672-5672
      port: 5672
      protocol: TCP
      targetPort: 5672
    - name: 15672-15672
      port: 15672
      protocol: TCP
      targetPort: 15672
  selector:
    app: rabbitmq
  type: NodePort

结果如下:


以上是关于2022-02-24:k8s安装rabbitmq,yaml如何写?的主要内容,如果未能解决你的问题,请参考以下文章

k8s部署rabbitmq集群

2022-02-24 安装微信开发者工具失败,报错:无法写入libgit2.lib

2022-02-24 uniapp调试微信开发者工具,点击预览没反应,而且工具没有显示代码区

k8s部署Rabbitmq集群

基于k8s手动部署rabbitmq集群

在K8S上部署rabbitmq集群-有状态服务