RabbitMQ配置文件在Kubernetes部署中无法解决

问题描述 投票:0回答:1

我正在尝试在Kubernetes集群上部署RabbitMQ,并使用initcontainer从ConfigMap复制文件。但是,POD处于运行状态后,该文件未复制。

[最初,我尝试不使用initcontainer,但出现类似“ touch:无法触摸'/etc/rabbitmq/rabbitmq.conf':只读文件系统。”]的错误

kind: Deployment
metadata:
  name: broker01
  namespace: s2sdocker
  labels:
    app: broker01
spec:
  replicas: 1
  selector:
    matchLabels:
      app: broker01
  template:
   metadata:
     name: broker01
     labels:
       app: broker01
   spec:
     initContainers:
      - name: configmap-copy
        image: busybox
        command: ['/bin/sh', '-c', 'cp /etc/rabbitmq/files/definitions.json /etc/rabbitmq/']
        volumeMounts:
          - name: broker01-definitions
            mountPath: /etc/rabbitmq/files
          - name: pre-install
            mountPath: /etc/rabbitmq

     containers:
      - name: broker01
        image: rabbitmq:3.7.17-management
        envFrom:
          - configMapRef:
              name: broker01-rabbitmqenv-cm
        ports:
        volumeMounts:
          - name: broker01-data
            mountPath: /var/lib/rabbitmq
          - name: broker01-log
            mountPath: /var/log/rabbitmq/log
          - name: broker01-definitions
            mountPath: /etc/rabbitmq/files
     volumes:
       - name: pre-install
         emptyDir: {}
       - name: broker01-data
         persistentVolumeClaim:
           claimName: broker01-data-pvc
       - name: broker01-log
         persistentVolumeClaim:
           claimName: broker01-log-pvc
       - name: broker01-definitions
         configMap:
            name: broker01-definitions-cm

文件“ definitions.json”应复制到/ etc / reabbitmq文件夹。我遵循了“ Kubernetes deployment read-only filesystem error”。但是问题没有解决。

我正在尝试在Kubernetes集群上部署RabbitMQ,并使用initcontainer从ConfigMap复制文件。但是,POD处于运行状态后,该文件未复制。最初,我有...

kubernetes rabbitmq
1个回答
0
投票

您可以检查/ etc / rabbitmq /的权限。用户是否有权将文件复制到上面的位置?

© www.soinside.com 2019 - 2024. All rights reserved.