kubernetespersistent-volumespersistent-volume-claims

Persistent volume isn't matched with a claim


I created a simple local storage volume. Something like this:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: vol1
spec:
  capacity:
    storage: 1Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /srv/volumes/vol1
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - my-node

The I create a claim:

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

For unknow reason they don't get matches. What am I doing wrong?


Solution

  • I figured it out. I just needed a user. As long as I had a user, everything worked perfectly.