K8S 之Pod简单提供持久化存储

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

  

原文地址:https://www.cnblogs.com/NGU-PX/p/14234448.html