Volume可以为容器提供持久化存储,比如:
1. yaml文件
# cat redis.yaml apiVersion: v1 kind: Pod metadata: name: redis namespace: test spec: containers: - name: redis image: redis volumeMounts: - name: redis-storage mountPath: /tmp/kyle/dir/redis volumes: - name: redis-storage emptyDir: {}
2. 创建
kubectl create -f redis.yaml