May 2018
Intermediate to advanced
554 pages
13h 51m
English
emptyDir is the simplest volume type, which will create an empty volume for containers in the same Pod to share. When the Pod is removed, the files in emptyDir will be erased, as well. emptyDir is created when a Pod is created. In the following configuration file, we'll create a Pod running Ubuntu with commands to sleep for 3600 seconds. As you can see, one volume is defined in the volumes section with name data, and the volumes will be mounted under the /data-mount path in the Ubuntu container:
// configuration file of emptyDir volume# cat 2-6-1_emptyDir.yamlapiVersion: v1kind: Podmetadata: name: ubuntu labels: name: ubuntuspec: containers: - image: ubuntu command: - sleep - "3600" imagePullPolicy: IfNotPresent name: ubuntu volumeMounts: ...
Read now
Unlock full access