Score:0

PV still has "Available" status despite of PVC was created

jp flag

I try to understand how Persistent volume works in Kubernetes and faced with some trouble. I use minikube and start it on Windows 10 Pro. My goal is to add volume c:\manifests\data to my test pod. This is my PV manifest:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-test-pv
spec:
  accessModes:
    - ReadWriteOnce
  local:
    path: 'c:\manifests\data\'
  capacity:
    storage: 2Gi
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - minikube
  persistentVolumeReclaimPolicy: Retain  

c:\manifests\kubectl get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM                            STORAGECLASS   REASON   AGE
my-test-pv                                 2Gi        RWO            Retain           Available                                                            54s

Then I try to create PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  volumeName: my-test-pv
      

And nothing changes in my cluster. my-test-pv still available, but I assumed it have to be Bound state. What I did wrong?

I'll use this manifest for testing my PV:

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: my-test-pod
      image: nginx
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.