来自守护程序的错误响应:创建安装源路径权限时出错

时间:2019-11-27 11:18:15

标签: kubernetes kubectl docker-volume kubernetes-pvc

这是我针对K8的postgress配置

apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: postgres
  template:
    metadata:
      labels:
        component: postgres
    spec:
      volumes:
        - name: postgres-storage
          persistentVolumeClaim:
            claimName: database-persistent-volume-claim
      containers:
      - name: postgres
        image: postgres
        ports:
        - containerPort: 5432
        volumeMounts:
          - mountPath: /var/lib/postgresql/data
            name: postgres-storage

以下是事件日志

Events:
  Type     Reason     Age                From                     Message
  ----     ------     ----               ----                     -------
  Normal   Scheduled  35s                default-scheduler        Successfully assigned default/postgres-deployment-d57b94d8-qnk8j to docker-desktop
  Normal   Pulling    11s (x3 over 34s)  kubelet, docker-desktop  Pulling image "postgres"
  Normal   Pulled     6s (x3 over 30s)   kubelet, docker-desktop  Successfully pulled image "postgres"
  Normal   Created    6s (x3 over 29s)   kubelet, docker-desktop  Created container postgres
  Warning  Failed     6s (x3 over 29s)   kubelet, docker-desktop  Error: failed to start container "postgres": Error response from daemon: error while creating mount source path '/host_mnt/c/Users/DupinderDhiman/.docker/Volumes/database-persistent-volume-claim/pvc-c8155b21-10d9-11ea-b05a-00155d380104': mkdir /host_mnt/c/Users/DupinderDhiman/.docker: permission denied

是的,我知道你会说,分享驱动器。 我做了 docker run --rm -v c:/Users:/data alpine ls /data

All Users
CatalystOne
Default
Default User
DupinderDhiman
Public
desktop.ini

此命令运行得很好

因此问题与驱动器共享无关

好吧,下一个问题可能与c:/ specificFolder权限有关。我是否勾选了共享权限中的所有复选框

现在我被困住了

1 个答案:

答案 0 :(得分:2)

所以花了一些时间后,我记得我创建了一个用户,用于共享名为Docker的驱动器,名称为dockerUser

因此,我授予的权限仅适用于Administrative user我自己的用户DupinderDhiman,而不适用于dockerUser

因此转到C:/user/DupinderDhiman/.docker,右键单击转到属性goto security tab 单击Edit按钮“要更改权限,请单击“编辑”,然后单击Add按钮 enter image description here

现在单击高级>,然后在新对话框的底部找到Find按钮,您将找到一个列表,找到DockerUser>选择它以按ok

enter image description here

enter image description here

好吧好吧>应用更改

单击确定关闭所有打开的对话框。应用更改并运行命令。看到您现在不会出现此错误。