Kubernetes本地持久卷无法安装现有路径

时间:2019-04-16 05:17:44

标签: kubernetes

编辑:

我已经解决了这个问题。 Rancher是Kubernetes的容器化部署。 Please see this answer

原始问题:

我尝试将本地持久卷与kubernetes 1.13一起使用。但是它总是告诉我本地路径不存在。

这是我的规格:

### 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

当我尝试使用pvc创建pod时,总是会出现以下错误:

MountVolume.NewMounter initialization failed for volume "sawtooth-local-pv-000015" : path "/mnt/disks/sdb1" does not exist

以下是有关磁盘的信息:

## 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

0 个答案:

没有答案