KJ0*_*797 0 kubernetes persistent-volumes
假设我创建了一个 hostPath 类型的 PersistentVolume:
kind: PersistentVolume
apiVersion: v1
metadata:
name: mypv
spec:
storageClassName: normal
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: /etc/foo # Path on the host machine
Run Code Online (Sandbox Code Playgroud)
我创建相应的 PersistentVolumeClaim,并在 Pod 中使用它:
apiVersion: v1
kind: Pod
metadata:
labels:
run: busybox
name: busybox
spec:
containers:
- image: busybox
name: busybox
volumeMounts:
- name: myvolume
mountPath: /var/log # is this relative to the hostPath of the PV?
restartPolicy: Never
volumes:
- name: myvolume
persistentVolumeClaim
claimName: mypvc
status: {}
Run Code Online (Sandbox Code Playgroud)
预期结果是{hostPath}/{mountPath}(例如/etc/foo/var/log),还是我必须专门定义mountPath: /etc/foo/var/log才能得到它?
| 归档时间: |
|
| 查看次数: |
199 次 |
| 最近记录: |