Updated at: 2022-12-09 03:49:50
In Mount Volumes, you can mount Exist Volume, Temporary Volume, and Mount ConfigMap or Secret.
► Exist Volume
It can be used to store user data persistently, and requires to be created in advance.
► Temporary Volume
It is of type emptyDir, and allocated to the host along with the Pod. If the Pod is deleted from the host, the temporary volume is also deleted and the data in the volume is permanently deleted. The container crash does not remove the Pod from the node, so the data in emptyDir volume is safe in case of container crash.
► Mount ConfigMap or Secret
The values in ConfigMap or Secret can be mounted to volume, supporting the file path of the Secret to be used and each Secret to be exposed. The directory is finally set in the mount path of container.
The Secret volume is used to pass confidential information (such as passwords) to the Pod. Secret volume is supported by tmpfs (a RAM-based file system), and never written to non-volatile memory.
ConfigMap is used to store configuration data in the form of key-value pairs, which can be used in the Pod, or to store configuration data for system components like the Controller. Although ConfigMap is similar to Secret, ConfigMap is more convenient for handling strings that do not contain confidential information. ConfigMap is much like the /etc directory in Linux, a directory dedicated to storing configuration files.
• ConfigMap is commonly used as follows:
• Set the value of environmental variable;
• Set command line parameters in the container;
• Create the config file within data volume
Note: To use Secret or ConfigMap, you must create them in the configuration center first.
► Exist Volume
It can be used to store user data persistently, and requires to be created in advance.
► Temporary Volume
It is of type emptyDir, and allocated to the host along with the Pod. If the Pod is deleted from the host, the temporary volume is also deleted and the data in the volume is permanently deleted. The container crash does not remove the Pod from the node, so the data in emptyDir volume is safe in case of container crash.
► Mount ConfigMap or Secret
The values in ConfigMap or Secret can be mounted to volume, supporting the file path of the Secret to be used and each Secret to be exposed. The directory is finally set in the mount path of container.
The Secret volume is used to pass confidential information (such as passwords) to the Pod. Secret volume is supported by tmpfs (a RAM-based file system), and never written to non-volatile memory.
ConfigMap is used to store configuration data in the form of key-value pairs, which can be used in the Pod, or to store configuration data for system components like the Controller. Although ConfigMap is similar to Secret, ConfigMap is more convenient for handling strings that do not contain confidential information. ConfigMap is much like the /etc directory in Linux, a directory dedicated to storing configuration files.
• ConfigMap is commonly used as follows:
• Set the value of environmental variable;
• Set command line parameters in the container;
• Create the config file within data volume
Note: To use Secret or ConfigMap, you must create them in the configuration center first.
< Previous:
Next: >