Volume Type | Description |
---|---|
Use temporary path | / |
Use host path | Mount the file directory of the host where the container resides to the path specified by the container (corresponding to HostPath in Kubernetes). You can also choose not to set the source path (corresponding to EmptyDir in Kubernetes). If the source path is not specified, the system mounts the temporary directory of the assigned host to the mount target of the container.Local disk volumes that have specified source paths are suitable for persisting data to the host where the container resides, whereas EmptyDir is suitable for temporary storage for containers. |
Use NFS disk | Simply enter the NFS path. You can use Tencent Cloud's Cloud File Storage (CFS) or user-built NFS file storage. An NFS volume is suitable for persistent storage with frequent reads and writes in scenarios such as big data analysis, media processing, and content management. |
Use existing PersistentVolumeClaim | Use the storage of the existing PersistentVolumeClaim to declare the storage for workloads, and automatically assign or create a PersistentVolume and mount it to the corresponding pod. This is suitable for stateful applications created by StatefulSet. |
Use ConfigMap | A ConfigMap is mounted to a pod as a file system. You can mount the custom ConfigMap entries to a specific path. For more information, see ConfigMap Management. |
Use Secret | A Secret is mounted to a pod as a file system. You can mount custom Secret entries to a specific path. For more information, see Secret Management. |
/var/lib/kubelet/pods/pod_name/volumes/kubernetes.io~empty-dir
, and the lifecycle of the volume using the temporary directory is the same as the lifecycle of the Pod.This table shows the details of the use of different volumes. When you are creating a workload and have selected **Add Volume, you can refer to the following content to add the volume and set the mount point:
Volume | Mount Target | ||||
---|---|---|---|---|---|
Type | Name | Others | Destination Path | Sub-path | Read and Write Permissions |
Temporary path | Custom | / | Specify this path as needed, for example, /cache . | Mount only the sub-path or a single file in the selected volume, for example, /data or /test.txt . | Select as needed. |
Node path | Set the node path./var/lib/docker . |
||||
NFS disk | NFS Path: enter the CFS address or user-built NFS address.10.0.0.161:/ is an example NFS path. To obtain the NFS path, please log in to the CFS console, click the ID of the target file system and find it in **Mount under Linux** on the **Mount Target Info** tab. |
||||
Existing PVC | Choose a PVC as needed. | ||||
Tencent Cloud CBS | Select a cloud disk as needed. | ||||
ConfigMap | /data/config and the sub-path is dev , the data will be stored under /data/config/dev . |
||||
SECRET |
The following is a sample where which you can perform creation by using kubectl directly.
apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
containers:
- image: k8s.gcr.io/test-webserver
name: test-container
volumeMounts:
- mountPath: /cache
name: cache-volume
volumes:
- name: cache-volume
emptyDir: {}
Apakah halaman ini membantu?