Can a PVC be bound to a specific PV?

后端 未结 7 1228
一生所求
一生所求 2020-11-29 02:34

This was discussed by k8s maintainers in https://github.com/kubernetes/kubernetes/issues/7438#issuecomment-97148195:

Allowing users to ask f

相关标签:
7条回答
  • 2020-11-29 03:05

    I don't think @jayme's edit to the original answer is forward compatible.

    Though only documented as proposal, label selectors in PVCs seem to work with Kubernetes 1.3.0.

    I've written an example that defines two volumes that are identical except in labels. Both would satisfy any of the claims, but when claims specify

    selector:
        matchLabels:
          id: test2
    

    it is evident that one of the dependent pods won't start, and the test1 PV stays unbound.

    Can be tested in for example minikube with:

    $ kubectl create -f volumetest.yml
    $ sleep 5
    $ kubectl get pods
    NAME                              READY     STATUS    RESTARTS   AGE
    volumetest1                       1/1       Running   0          8m
    volumetest1-conflict              0/1       Pending   0          8m
    $ kubectl get pv
    NAME      CAPACITY   ACCESSMODES   STATUS      CLAIM          REASON    AGE
    pv1       1Gi        RWO           Available                            8m
    pv2       1Gi        RWO           Bound       default/test             8m
    
    0 讨论(0)
提交回复
热议问题