Inline file content embeds a short file directly in a Pod manifest. An init container writes that content into an emptyDir volume, making the file available to other containers through a mounted path. section 9.2.2
Create a file during Pod initialization
An init container can run a shell heredoc such as `cat <<EOF > /mnt/my-volume/my-file.txt`, write several lines defined in the manifest, and mount the target volume at `/mnt/my-volume`. This is useful for one or two short files, such as application configuration. section 9.2.2
Listing 9.6 Creating a file from inline contents
spec:
initContainers: #1
- name: my-volume-initializer #1
image: busybox #1
command: #2
- sh #2
- -c #2
- | #2
cat <<EOF > /mnt/my-volume/my-file.txt #2
line 1: This is a multi-line file #3
line 2: Written from an init container #3
line 3: Defined inline in the Pod manifest #3
EOF #4
volumeMounts: #5
- name: my-volume #5
mountPath: /mnt/my-volume #5
containers:
...
Shows the init container command, multiline inline content, and volume mount used to create the file. section 9.2.2
