Error response from daemon: error while creating mount source path '/mnt/registry': mkdir /mnt/registry: permission denied

2025. 1. 1. 00:54k8s

minikube ssh

docker\@minikube:\~\$ whoami

docker


sudo chown -R root\:root /mnt/registry

chown: cannot access '/mnt/registry': Permission denied



chown -R root\:root /mnt/registry

chown: changing ownership of '/mnt/registry': Operation not permitted

registry는 root로 작동이되는데, /mnt가 docker:docker로 설정되어 있는 경우 권한 문제가 발생함

hostPath는 OS의 권한에 영향을 받기 때문에, Kubernets에서 관리되는 PVC를 사용하는 것이 정신건강에 좋을듯

ASIS

      volumes:
      - name: upload
        hostPath:
          path: /mnt/registry

TOBE

  volumeClaimTemplates:                # Replaced hostPath with PVC
  - metadata:
      name: upload
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 1Gi