Welcome to the Linux Foundation Forum!

Lab 8.3 pvc-one stuck in "Pending" status

Options

Hi!

I'm working through Lab 8.3 at the moment and somehow I can't create a PVC that works as expected.

I successfully created the PersistentVolume. The output of kubectl get pv pvvol-1 -o yaml looks like this:

apiVersion: v1
kind: PersistentVolume
metadata:
  creationTimestamp: "2023-04-29T11:14:54Z"
  finalizers:
  - kubernetes.io/pv-protection
  name: pvvol-1
  resourceVersion: "14977"
  uid: b5efe537-6f46-4eb5-8d03-f03f79c161d9
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  nfs:
    path: /opt/sfw
    server: hammerhead
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem
status:
  phase: Available

But the PersistentVolumeClaim never leaved the status "Pending". The output of kubectl get pvc pvc-one -o yaml looks like this:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: "2023-04-29T11:15:00Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: pvc-one
  namespace: default
  resourceVersion: "14980"
  uid: 1e9a5f78-ac59-423d-85a5-49983b24b2a8
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 200Mi
  storageClassName: local-path
  volumeMode: Filesystem
status:
  phase: Pending

I have to say, I run a single node k3s cluster at the moment, but I don't think that should matter here. All steps up to step 3 worked just fine.

Any ideas, what I might be wrong? Any hint on how do debug my problem?

Best regards,
Andreas

Comments

  • schuam
    schuam Posts: 11
    Options

    Ok, I found a solution to my problem. I had to add storageClassName: "" in the pvc.yaml file. Now it looks like this:

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: pvc-one
    spec:
      storageClassName: ""    <-- added
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 200Mi
    

    I came up with that after reading about Persistent Volumes on the kubernetes website. Apparently this has to do with whether or not the admission plugin in the cluster is turned on or not.

    Maybe this helps anyone with a similar problem.

  • m.taniguchi
    m.taniguchi Posts: 20
    Options

    Thanks! this post helped me :)

  • anas.zurkiyeh
    Options

    Thank you. Solved my issue!

  • uldiskk
    uldiskk Posts: 1
    Options

    Adding hostname "cp" to the hosts file of the node helped.

Categories

Upcoming Training