Projecting volumes
It's possible to project multiple volumes into a single directory, so they appear as a single volume. The supported volume types are Kubernetes-managed: secret
, downwardAPI
, and configMap
. This is useful if you want to mount multiple sources of configuration into a pod. Instead of having to create a separate volume for each source, you can bundle all of them into a single projected volume. Here is an example:
apiVersion: v1
kind: Pod
metadata:
name: the-pod
spec:
containers:
- name: the-container
image: busybox
volumeMounts:
- name: all-in-one
mountPath: "/projected-volume"
readOnly: true
volumes:
- name: all-in-one
projected:
sources:
- secret:
name: the-secret
items:
- key: username
path: the-group/the-user
- downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata...