ืืืขืืื ืื ื ืืงืืจ ืืขืืืง ืืช:
ืื ืื ื ืืชืืืืื ืขื:
โ ืชืืงืืื ืืืฉื
โ ืืื ืงืืฆืื ืงืืืืื
ื ืืฆืืจ ืงืืืฅ ืืืฉ:
vi empty-dir-example.yaml
ืืืืง:
apiVersion: v1
kind: Pod
metadata:
name: empty-dir-demo
spec:
containers:
- name: empty-dir-writer
# Instead of using a custom image,
# we use BusyBox with tag 1.36.1
image: busybox:1.36.1
# We do NOT expose any ports
# This pod does not need networking for this example
# We override the command so the container stays alive
# We pass a list of strings:
# - "sh" to run shell
# - "-c" to execute a shell command
# - "sleep 3600" to keep it running
command: ["sh", "-c", "sleep 3600"]
volumeMounts:
- name: temporary-storage
# IMPORTANT:
# This name must match the volume name defined below
# Up until now, names were mostly arbitrary
# Here the name acts as a reference
mountPath: /usr/share/temp
# This is the directory inside the container
# where the volume data becomes available
volumes:
- name: temporary-storage
# emptyDir creates ephemeral storage
# It is bound to the Pod lifecycle
# If the Pod gets deleted,
# the directory and ALL stored data are deleted
emptyDir: {}
# Empty braces mean:
# - No medium specified
# - No sizeLimit specified
# Default medium is node disk
# In probably 99% of cases, disk storage is used