Kops: PVC not binding to NFS PV

Created on 22 May 2017  路  2Comments  路  Source: kubernetes/kops

I am not sure if this is a kops issue but definitely seeing this problem on K8S cluster installed using KOPS. I created a physical volume that uses NFS (AWS EFS) but PVC is not binding to it. Instead it creates another EBS disk. Here is the log:

> kubectl get pv
NAME      CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS      CLAIM     STORAGECLASS   REASON    AGE
mynfspv   100Gi      RWX           Retain          Available                                      7s

create PVC now

> kubectl get pvc
NAME       STATUS    VOLUME                                     CAPACITY   ACCESSMODES   STORAGECLASS   AGE
mynfspvc   Bound     pvc-a081c470-3f23-11e7-9d30-024e42ef6b60   100Gi      RWX           default        4s

> kubectl get pv
NAME                                       CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS      CLAIM              STORAGECLASS   REASON    AGE
mynfspv                                    100Gi      RWX           Retain          Available                                               50s
pvc-a081c470-3f23-11e7-9d30-024e42ef6b60   100Gi      RWX           Delete          Bound       default/mynfspvc   default                  17s



md5-36e54d0c3f4efafc54701ada18eeecbe



apiVersion: v1
kind: PersistentVolume
metadata:
  name: mynfspv
  labels:
    name: nfs2
spec:
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    server: dbc56.efs.us-west-2.amazonaws.com
    path: /



md5-6821485f43c2240c5c70c3afa62b4347



kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mynfspvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi

Most helpful comment

@kamalhussain this is not a kops issue. In your PVC use the following:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mynfspvc
  annotations:
    volume.beta.kubernetes.io/storage-class: ""
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi

You need an annotation so that the PVC does not automatically use a dynamic storage class.

All 2 comments

@kamalhussain this is not a kops issue. In your PVC use the following:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mynfspvc
  annotations:
    volume.beta.kubernetes.io/storage-class: ""
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi

You need an annotation so that the PVC does not automatically use a dynamic storage class.

Thanks. I also figured that I can add a tag "storageClassName" on both PV and PVC to make this work. For example, I added "storageClassName: slow" on both PV and PVC.

Was this page helpful?
0 / 5 - 0 ratings