- 
                Notifications
    
You must be signed in to change notification settings  - Fork 301
 
Description
I have migrated to WSL2 - Windows 10.
Since I have the following issue :
Hostpath volume are not mounted into containers. (directory are empty)
The volumes are well created, the desired path is correct. Like
/volumes/my-cluster/services1/www
Directory "/volumes" have 777 permissions
Volumes looks like that :
vol-www 30Mi RWO Retain Bound jeedom/pvc-www hostpath 19m
PersistenVolumeClaim are bounds to the volumes
pvc-www Bound vol-www 30Mi RWO hostpath 19m
In WSL1, at the start of the deployment (or helm charts installation). If Directories does not exists, they are created. Volume are mounted to the containers and work well
Conditions : volumes must be mounted in /c/.... (not in /mnt/c/...)
With WSL2, there is no need to mount volume in /c/...
docker run -v /volumes/my-cluster/services1/www:/var/html/www my-image work well.
With kubernetes, local directories are not created. directory in container are empty. When creating a files on wsl path, it's not appears in the container, and the other way around doesn't work either.
More, the method who works with WSL1 don't work with WSL2 (mount volume in /c/...)
Thanks
Information
- 
Windows Version: 10 build 19037
 - 
Docker Desktop Version: 2.1.7.0 (41536) Edge
 - 
Kubetctl Version Client : 1.17.0
Server : 1.15.5 - 
helm V3.0.1+g7c22ef9
 - 
Docker 19.03.5
 
Deployment File
# Source: charts/supervision/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: supervision
  namespace: j*****m
  labels:
    app.kubernetes.io/name: supervision
    helm.sh/chart: supervision-2.0.1-beta
    app.kubernetes.io/version: "1.0"
    app.kubernetes.io/managed-by: Helm
spec: 
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: supervision
  strategy:
    rollingUpdate: 
      maxSurge: 1
      maxUnavailable : 1 
    type: RollingUpdate 
    
  # Template
  template:
    metadata:
      labels:
        app.kubernetes.io/name: supervision
    spec:
      
      hostname: supervision
      containers:
         # Image
       ....
       - image: "*****1.3"
          imagePullPolicy: IfNotPresent
          # Volumes
          volumeMounts:
            - name: logs
              mountPath: /var/log/mosquitto
       ....
      # Volumes
      volumes:
      - name: logs
        persistentVolumeClaim:
          claimName: "pvc-supervision-logs"
      - name: persistence
        persistentVolumeClaim:
          claimName: "pvc-supervision-persistence"
Source: charts/supervision/templates/persistent-volumes.yaml
kind: PersistentVolume
apiVersion: v1
metadata: 
  name: "vol-persistence"
  labels:
    volume: persistence
spec:
  storageClassName: hostpath
  capacity:
    storage: 30Mi
  accessModes:
  - ReadWriteOnce
  hostPath:
    path: /c/Workspace/volumes/mqtt/persistence
---
# Source: charts/supervision/templates/persistent-volumes.yaml
kind: PersistentVolume
apiVersion: v1
metadata: 
  name: "vol-logs"
  labels:
    volume: logs
spec:
  storageClassName: hostpath
  capacity:
    storage: 50Mi
  accessModes:
  - ReadWriteOnce
  hostPath:
    path: /c/Workspace/volumes/mqtt/logs
Source: charts/supervision/templates/persistent-volume-claims.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: "pvc-supervision-persistence"
spec:
  storageClassName: hostpath
  volumeName: "vol-persistence"
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 30Mi
---
# Source: charts/supervision/templates/persistent-volume-claims.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: "pvc-supervision-logs"
spec:
  storageClassName: hostpath
  volumeName: "vol-logs"
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 50Mi