Steps to Use the Same EFS for Different Clusters or Namespaces in AWS
Steps to Use the Same EFS for Different Clusters or Namespaces in AWS
-
Connect to an existing EC2 instance or create a new one. Ensure that the security group and VPC are the same for both the fileshare and the EC2 instance.
-
To create a new instance, select the Launch Instances option as shown below:
-
Provide a name for the instance and specify the key pair name. This will generate a key used to connect to the VM instance using the SSH option.
-
In the network settings, select the VPC and security group that match the EFS fileshare as shown below, then launch the instance.
-
Once the instance is created, click the Connect option for that instance.
-
Copy the SSH command and run it in the command prompt to connect to the VM.
-
Open the command prompt and navigate to the location where the key was downloaded.
-
Once connected to the VM, run the following commands.
sudo yum -y update sudo yum -y install nfs-utils OR sudo apt update sudo apt install nfs-kernel-server
-
Create a directory to mount the EFS fileshare in that folder.
sudo mkdir efsmount
-
Go to the EFS fileshare used for the Bold Reports application and click the Attach option.
-
Copy the NFS client command and run it in the EC2 instance VM, modifying the directory name to the location where you want to mount.
Example :
If you are mounting to the efsmount folder in the EC2 instance VM, adjust the command as shown below:
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-0db7f575028fc1023.efs.us-east-1.amazonaws.com:/ efsmount
-
Once the directory is mounted, it acts as a fileshare. Creating a subdirectory in the mounted directory will automatically create the same subfolder in the fileshare. Use the command below to create a subfolder in the mounted directory:
Command:
sudo mkdir stagingefs
-
Then change the path in the pvclaim_eks.yaml file with the sub directory name as shown below.
-
Next, apply all the YAML files. Once all the pods are in the running state, you will find the configuration files in the subdirectory mounted on the client VM.