2018-05-31-volume 容器存储
多 volueme 书写注意
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: tom-volume
spec:
replicas: 2
template:
metadata:
labels:
run: tom-volume
spec:
containers:
- image: registry.cn-hangzhou.aliyuncs.com/misa/tomcat:9.0
name: tom-volume
ports:
- containerPort: 8080
name: port8080
volumeMounts:
- mountPath: /usr/local/tomcat/logs/ # 容器内路径
name: log # 要与 volume 中 name 匹配
- mountPath: /mnt # 容器内路径
name: other
volumes:
- name: log
hostPath:
path: /tmp/logs/ # 使用 pod 所在节点的路径
- name: other
emptyDir: {}使用 nfs
使用 hostpath
使用 emptydir
Last updated