Skip to content

Windows host persistent volume problem #6

Description

@agnoam

Hey,
I'm trying to make a deployment with a local persistent volume attached to it. (for development)

I managed to do this on Linux like Kubernetes declarations below.
I tried the C:\ format in hostPath.path but, it seems Kubernetes not support this.

Does anyone know how to make this work on Windows ?

Kubernetes declarations

Volume declaration

apiVersion: v1
kind: PersistentVolume
metadata:
  name: test-volume
  labels:
    type: local
spec:
  storageClassName: hostpath
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/home/k8s/myTestVolume"
    type: DirectoryOrCreate

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-volume-claim
spec:
  storageClassName: hostpath
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi

Deployment declaration

apiVersion: apps/v1
kind: Deployment

metadata:
  name: test-app
spec:
  selector:
    matchLabels:
      app: test-app
  template:
    metadata:
      labels:
        app: test-app
    spec:
      volumes:
        - name: test-storage
          persistentVolumeClaim:
            claimName: test-volume-claim
      securityContext: {}
      containers:
        - name: test-container
          image: busybox
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /home/data
              name:  test-storage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions