Kubernetes Pod即使具有持久存储也不会保存数据

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

我正在使用部署在K8上的JBPM业务中心。下面是我的depolyment.apps,其中附着有永久卷。

kubectl edit deployment.apps/jbpm-server-full
     volumes:
      - name: jbpm-pv-storage
        persistentVolumeClaim:
          claimName: jbpm-pv-claim

但是当我重新启动Pod时,即使我们已将永久卷附加到k8S pod上,我也失去了业务中心的所有工作空间。

kubernetes jbpm
1个回答
0
投票

您需要在容器内安装该卷并将数据写入已安装的路径

apiVersion: v1
kind: Pod
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
        claimName: task-pv-claim
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: task-pv-storage

https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/

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