apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
containers:
- image: k8s.gcr.io/test-webserver #写入的容器
name: test-container-write
volumeMounts:
- mountPath: /cache
name: cache-volume #使用的数据卷名称,跟volumes:name要能匹配上
- image: k8s.gcr.io/test-webserver #读取的容器
name: test-container-read
volumeMounts:
- mountPath: /cache
name: cache-volume #使用的数据卷名称,跟volumes:name要能匹配上
volumes: #定义数据卷来源,支持定义多个数据卷
- name: cache-volume #定义数据卷的名称1
emptyDir: {}
- name: cache-volume2 #定义数据卷的名称2
emptyDir: {}