简体   繁体   English

持久卷声明 - 挂载路径

[英]Persistent volume claim - mount path

I have a pv like below我有一个像下面这样的pv

apiVersion: v1
kind: PersistentVolume
metadata: 
  name: azurefile

spec:
  capacity:
    storage: 5Gi
  accessModes: 
    - ReadWriteMany
  storageClassName: azurefile
  azureFile:
    secretName: azure-secret
    shareName: cloudshare
    readOnly: false

and a pvc like below和下面这样的pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:  
  name: azurefile
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: azurefile
  resources:
    requests:
      storage: 2Gi  

on deployments i have the following在部署我有以下

      volumes:      
        - name: my-storage
          persistentVolumeClaim:
              claimName: azurefile
      volumeMounts:
          - name:  my-storage
            mountPath:  "/home/myapp/newapp/"

My understanding is that under the path /home/myapp/newapp/ in the containers,the azure fileshare cloudshare 's content will be accessible.我的理解是,在容器中的路径/home/myapp/newapp/下,可以访问azure文件共享cloudshare的内容。 So, whatever i have in cloudshare will be visible here.因此,我在cloudshare中的所有内容都将在此处可见。 Does pvc or pv creates folders under the cloudshare ? pvcpv是否在cloudshare下创建文件夹? , the reason i ask is, I have a WORKDIR in my dockerimage which is actually in the same mountpath like below ,我问的原因是,我的dockerimage中有一个WORKDIR ,它实际上与下面的mountpath相同

WORKDIR /home/myapp/newapp/reta-app/ . WORKDIR /home/myapp/newapp/reta-app/

For some reason reta-app folder is getting created inside the cloudshare .由于某种原因,在cloudshare中创建了reta-app文件夹。 Is this a normal behaviour or i am doing something wrong.这是正常行为还是我做错了什么。

Does pvc or pv create folders under the cloudshare ? pvcpv是否在cloudshare下创建文件夹?

No. A Kubernetes PersistentVolume is just some storage somewhere, and a PersistentVolumeClaim is a way of referencing a PV (that may not immediately exist).不。Kubernetes PersistentVolume 只是某处的一些存储,而 PersistentVolumeClaim 是引用 PV 的一种方式(可能不会立即存在)。 Kubernetes does absolutely no management of any of the content in a persistent volume; Kubernetes 绝对不管理持久卷中的任何内容; it will not create directories on startup, copy content from the image into a volume, or anything else.它不会在启动时创建目录、将图像中的内容复制到卷中或其他任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM