Files
website/docs/tasks/inject-data-application/dapi-volume.yaml
T
Joel Smith 5ec5118445 Don't encourage people to mount downwardAPI volumes on /etc (#7484)
Because API data volumes like downwardAPI are expected to be fully
managed by Kubernetes and are now mounted read-only, this causes
problems with other files in /etc like /etc/resolv.conf that Docker
tries to add to the volume. Our examples should show such volumes
being mounted to a dedicated subdirectory for the volume.
2018-02-23 10:06:45 -08:00

40 lines
970 B
YAML

apiVersion: v1
kind: Pod
metadata:
name: kubernetes-downwardapi-volume-example
labels:
zone: us-est-coast
cluster: test-cluster1
rack: rack-22
annotations:
build: two
builder: john-doe
spec:
containers:
- name: client-container
image: k8s.gcr.io/busybox
command: ["sh", "-c"]
args:
- while true; do
if [[ -e /etc/podinfo/labels ]]; then
echo -en '\n\n'; cat /etc/podinfo/labels; fi;
if [[ -e /etc/podinfo/annotations ]]; then
echo -en '\n\n'; cat /etc/podinfo/annotations; fi;
sleep 5;
done;
volumeMounts:
- name: podinfo
mountPath: /etc/podinfo
readOnly: false
volumes:
- name: podinfo
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
- path: "annotations"
fieldRef:
fieldPath: metadata.annotations