Edit:
I've solved this issue. Rancher is a containerized deployment of kubernetes. Please see this answer
Original Questions:
I tried to use local persistent volume with kubernetes 1.13. But it always told me the local path not exist.
Here are my specifications:
### pv.yml
apiVersion: v1
kind: PersistentVolume
metadata:
name: sawtooth-local-pv-000015
namespace: sawtooth
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
storageClassName: local-storage-normal
local:
path: /mnt/disks/sdb1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- sawtooth-4
## pvc.yml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sawtooth-local-pvc-000015
namespace: sawtooth
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: local-storage-normal
## sc.yml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage-normal
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
# Supported policies: Delete, Retain
reclaimPolicy: Retain
When I tried to create a pod using the pvc, it always give me this error:
MountVolume.NewMounter initialization failed for volume "sawtooth-local-pv-000015" : path "/mnt/disks/sdb1" does not exist
Here's some infomation about the disks:
## fdisk -l
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 125829119 125827072 60G 83 Linux
## /etc/fstab
/dev/sdb1 /mnt/disks/sdb1 ext4 defaults 0 0