Created
October 21, 2018 20:37
-
-
Save matthewpalmer/bd10ea5360bdf3d735109a68050afeaa to your computer and use it in GitHub Desktop.
Kubernetes volume example YAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Pod | |
apiVersion: v1 | |
metadata: | |
name: simple-volume-pod | |
spec: | |
# Volumes are declared by the pod. They share its lifecycle | |
# and are communal across containers. | |
volumes: | |
# Volumes have a name and configuration based on the type of volume. | |
# In this example, we use the emptyDir volume type | |
- name: simple-vol | |
emptyDir: {} # No extra configuration | |
# Now, one of our containers can mount this volume and use it like | |
# any other directory. | |
containers: | |
- name: my-container | |
volumeMounts: | |
- name: simple-vol # This is the name of the volume we set at the pod level | |
mountPath: /var/simple # Where to mount this directory in our container | |
# Now that we have a directory mounted at /var/simple, let's | |
# write to a file inside it! | |
image: alpine | |
command: ["/bin/sh"] | |
args: ["-c", "while true; do date >> /var/simple/file.txt; sleep 5; done"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment