I have the following persistent volume and volume claim:
kind: PersistentVolume
apiVersion: v1
metadata:
name: kloud
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
nfs:
server: 172.21.51.42
path: /
readOnly: false
and:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: kloud
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
The nfs server is AWS EFS. I specifically ssh to k8s master and checked that I can manually mount the NFS volume. But when I create the volume and the claim with kubectl it indefinitely hangs there pending:
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
kloud Pending gp2 8s
If I change the mode to ReadWriteOnce
, it works as expected and won't hang.
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
kloud Bound pvc-c9a01bff-94d0-11e7-8ed4-0aec4a0f734a 100Gi RWO gp2
Is there something I missing? How can I create a RWX claim with k8s and EFS?
From the Services menu, select EFS . Create a new file system and select the VPC where your cluster is located. The VPC can be identified by your cluster ID. Select the availability zone with the subnets your instances are located on and the security groups of your node pools.
EFS PV provides ReadWriteMany access mode. EBS PV provide only ReadWriteOnce access mode. AN EFS file system can be accessed from multiple availability zones and it is the valuable for multi-AZ cluster.
Amazon Elastic File System (Amazon EFS) is a simple, serverless, set-and-forget, cloud native file system, enabling you to build modern applications, persist and share data from your AWS containers and serverless applications, with zero management required.
Building the Terraform EFS Configuration for AWSLog in to the Ubuntu machine with your favorite SSH client. 3. Open your preferred code editor, and create a file called main.tf inside the ~/terraform-amazon-efs-demo directory. Copy/paste the following configuration to the main.tf file, and save the changes.
You will need to setup the EFS-provisioner in your cluster. Mounting EFS is still not supported by the default Kubernetes distribution and as such you need this extension: https://github.com/kubernetes-incubator/external-storage/tree/master/aws/efs
You'll need to set up it's storage class:
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: aws-efs
provisioner: example.com/aws-efs
And then write PVC's of the type:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: efs
annotations:
volume.beta.kubernetes.io/storage-class: "aws-efs"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Mi
Don't mind the storage size, although it's not used by EFS, Kubernetes requires you to set something there for it to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With