'EKS EFS CSI Dynamic Provisioning Reattach PVC
The use case is where an Kubernetes application is torn down and its resources sc, pvc and pod are destroyed.
The storage is allocate via EKS EFS CSI driver using the dynamic provisioning approach as seen here.
When the application is spun up a second time, for it to reattach to the previously created pvc.
This does work when the workflow involves a pv (sc, pv, pvc & pod).
The question is, is it possible to reattach the the old pvc?
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: efs-sc-b
labels:
name: efs-sc-b
provisioner: efs.csi.aws.com
mountOptions:
- tls
parameters:
provisioningMode: efs-ap
fileSystemId: fs-0f1d04f9f97c5e2c1
directoryPerms: "700"
gidRangeStart: "1000"
gidRangeEnd: "2000"
basePath: "/default/efs-app-b"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim-b
labels:
name: efs-claim-b
spec:
accessModes:
- ReadWriteOnce # ReadWriteMany
storageClassName: efs-sc-b
resources:
requests:
storage: 5Gi
apiVersion: v1
kind: Pod
metadata:
name: efs-app-b
labels:
name: efs-app-b
spec:
containers:
- name: efs-app-b
image: centos:centos7.9.2009
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/efs-app-b.log; sleep 5; done"]
volumeMounts:
- name: persistent-storage
mountPath: /data
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim-b
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
