Persistent Volume State Pending

44 Views Asked by At

pvcomplete.yml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: manual
  hostPath:
    path: "/mnt/data/my-pv"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc-1
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: manual
  resources:
    requests:
      storage: 2Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc-2
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: manual
  resources:
    requests:
      storage: 1Gi
[cloudshell-user@ip-10-134-37-146 ~]$ kubectl apply -f pvcomplete.yml
persistentvolume/my-pv created
persistentvolumeclaim/my-pvc-1 created
persistentvolumeclaim/my-pvc-2 created
[cloudshell-user@ip-10-134-37-146 ~]$ kubectl get pv
NAME    CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM              STORAGECLASS   REASON   AGE
my-pv   5Gi        RWO            Retain           Bound    default/my-pvc-1   manual                  10s
[cloudshell-user@ip-10-134-37-146 ~]$ kubectl get pvc
NAME       STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
my-pvc-1   Bound     my-pv    5Gi        RWO            manual         13s
my-pvc-2   Pending                                      manual         13s

Please find the YML file and all outputs. I created the PV and PVC, but the second PVC is always coming as a pending state.

After executing the YAML file, the pv-vc-2 state is coming as pending. Could anyone please help me?

0

There are 0 best solutions below