Volumes:给containers挂载磁盘
创建多容器pod
# cat fortune-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: fortune
spec:
containers:
- image: luksa/fortune
name: html-generator
volumeMounts: #磁盘描述
- name: html
mountPath: /var/htdocs #将html磁盘mount到此
- image: nginx:alpine
name: web-server
volumeMounts: #磁盘描述
- name: html
mountPath: /usr/share/nginx/html #将html加载
readOnly: true
ports:
- containerPort: 80
protocol: TCP
volumes: #磁盘的申请或是定义
- name: html
emptyDir: {} #一个最简单的空磁盘创建一个可在容器中共享磁盘存储的卷
emptyDir磁盘
hostPath
使用持久化声明获取磁盘

思考题
最后更新于
这有帮助吗?