【问题标题】:write access error for mounted volume on kubernetesKubernetes 上已安装卷的写入访问错误
【发布时间】:2020-07-30 22:18:17
【问题描述】:

当我们在 azure kubernetes 服务 (aks) 中部署 active-mq 时,其中 active-mq 数据文件夹作为持久卷声明安装在 azure 托管磁盘上。下面是用于部署的 yaml。 使用的 ActiveMQ 映像:rmohr/activemq Kubernetes 版本:v1.15.7

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: activemqcontainer
spec:
  replicas: 1
  selector:
    matchLabels:
        app: activemqcontainer
  template:
    metadata:
      labels:
        app: activemqcontainer
    spec:
      securityContext:
        runAsUser: 1000
        fsGroup: 2000
        runAsNonRoot: false
      containers:
      - name: web
        image: azureregistry.azurecr.io/rmohractivemq
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 61616
        volumeMounts:
        -  mountPath: /opt/activemq/data
            subPath: data
            name: volume
        - mountPath: /opt/apache-activemq-5.15.6/conf/activemq.xml
          name: config-xml
          subPath: activemq.xml
      imagePullSecrets:
      - name: secret
      volumes:
      - name: config-xml
        configMap:
            name: active-mq-xml
      - name: volume
        persistentVolumeClaim:
            claimName: azure-managed-disk
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: azure-managed-disk
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: managed-premium
  resources:
    requests:
      storage: 100Gi

出现以下错误。

WARN | Failed startup of context o.e.j.w.WebAppContext@517566b{/admin,file:/opt/apache-activemq-5.15.6/webapps/admin/,null}
java.lang.IllegalStateException: Parent for temp dir not configured correctly: writeable=false
        at org.eclipse.jetty.webapp.WebInfConfiguration.makeTempDirectory(WebInfConfiguration.java:336)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebInfConfiguration.resolveTempDirectory(WebInfConfiguration.java:304)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:69)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:468)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:504)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)[jetty-all-9.2.25.v20180606.jar:9.2.2

【问题讨论】:

  • 这里的实际问题是什么?
  • 当我们尝试持久化数据(/opt/activemq/data)时,出现 ava.lang.IllegalStateException 错误:未正确配置临时目录的父级:writeable=false。导致activemq服务没有启动。
  • 我不想在这里学究气,但这不是问题。这是一个声明。
  • 请提供实际问题。

标签: azure kubernetes activemq azure-aks


【解决方案1】:

这是来自 activemq Web 管理控制台的警告。托管 Web 控制台的 Jetty 无法创建临时目录。

WARN | Failed startup of context o.e.j.w.WebAppContext@517566b{/admin,file:/opt/apache-activemq-5.15.6/webapps/admin/,null}
java.lang.IllegalStateException: Parent for temp dir not configured correctly: writeable=false

您可以通过在容器规范中设置环境变量 ACTIVEMQ_TMP 来覆盖默认临时目录

 env:
    - name: ACTIVEMQ_TMP
      value : "/tmp"

【讨论】:

    猜你喜欢
    • 2018-03-13
    • 1970-01-01
    • 2020-05-01
    • 2019-12-18
    • 2020-09-07
    • 1970-01-01
    • 2020-12-01
    • 2015-11-15
    • 1970-01-01
    相关资源
    最近更新 更多