docker-for-windows提供的k8s群集中的“ VolumeFailedDelete”错误

时间:2019-06-26 11:05:22

标签: kubernetes volume docker-for-windows

我创建了一个PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi

由于PVC未指定存储类别,因此它将使用群集的默认存储类别。对于我的群集,它是 hostpath

 $ kubectl get sc

    NAME                 PROVISIONER          AGE
    hostpath (default)   docker.io/hostpath   47d

此sc的ReclaimPolicy是删除。但是,当我删除pvc时,不会删除pv。删除卷时出错:

$ kubectl describe pv

Name:            pvc-eb128563-97fa-11e9-8f00-00155d380109
Labels:          <none>
Annotations:     pv.kubernetes.io/provisioned-by=docker.io/hostpath
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    hostpath
Status:          Released
Claim:           default/myclaim
Reclaim Policy:  Delete
Access Modes:    RWO
Capacity:        8Gi
Node Affinity:   <none>
Message:
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /host_mnt/c/Users/Anjana/.docker/Volumes/myclaim/pvc-eb128563-97fa-11e9-8f00-00155d380109
    HostPathType:
Events:
  Type     Reason              Age              From                                                                     Message
  ----     ------              ----             ----                                                                     -------
  Warning  VolumeFailedDelete  7s (x7 over 1m)  docker.io/hostpath DESKTOP-SRHMA82 87a9c372-97ca-11e9-bdd7-00155d38010b  persistent volume path is not prefixed by C:\Users\Anjana\.docker\Volumes

为什么会这样?谁能帮我吗?

2 个答案:

答案 0 :(得分:0)

基于收到的错误

  

持久卷路径没有前缀   C:\ Users \ Anjana.docker \ Volumes

并浏览documentation

  

pathPrefix是主机卷必须匹配的路径前缀。确实   不支持/foo。验证路径时修剪尾部斜杠   带主机路径的前缀。示例:/foo将允许/foo//foo/bar   并且/foo /food不允许/etc/foo hostPath: path:

您应该检查pv yaml规范中的路径配置是否正确。

Finalizers: [kubernetes.io/pv-protection]

编辑: 同样null表示您的PV已受到保护。您可以通过将终结器设置为Detected at URL: / Uncaught Exception: Error: Subquery returns more than 1 row Error No: 1242 SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, (SELECT price FROM oc_product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '1' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT `keyword` FROM oc_seo_url WHERE `query` = CONCAT('product_id=', p.product_id) AND language_id='1' AND store_id='0' LIMIT 1) as xseo, (SELECT GROUP_CONCAT(fdx.name) filter_name FROM oc_product_filter pfx INNER JOIN oc_filter fx ON fx.filter_id = pfx.filter_id INNER JOIN oc_filter_description fdx ON fdx.filter_id = pfx.filter_id AND fdx.language_id=1 AND fdx.filter_group_id=1 WHERE pfx.product_id = p.product_id GROUP BY pfx.product_id) product_filters, (SELECT price FROM oc_product_special ps WHERE ps.product_id = p.product_id AND ps.custo in system/library/db/mysqli.php:81

来更改

让我知道是否有帮助。

答案 1 :(得分:0)

我遇到了同样的问题。

警告VolumeFailedDeletepersistentvolume / pvc-888e0eed-a795-11e9-8838-00155d9d5106持久卷路径未以C:\ Users \ user.docker \ Volumes为前缀

通过PVC创建卷,将hostPath(自动)设置为 /host_mnt/c/Users/user/.docker/Volumes/myclaim/pvc-eb128563-97fa-11e9-8f00-00155d380109