How to mount aws EC2 files on aws EKS as presistent volume?

12/23/2021

I have a aws EC2 (EC2-A) and Amazon Managed Blockchain running in VPC (VPC-A)

  • This EC2-A instance has some files and certificates (required for executing transactions in the blockchain)
  • EC2-A has EBS storage which can be mounted on only one EC2 instance at one time.
  • Transactions can be only executed to the blockchain network from the EC2-A, since they're are in the same VPC-A.

I have an aws EKS (Kubernetes cluster) running in VPC-B.

How can I access the files and certificates of EC2-A from a pod in my k8s cluster. Also I have another pod which will be blockchain client executing transactions in the blockchain network, which is in VPC-A.

Both these VPC-A and VPC-B are in the same aws account.

-- Niraj Kumar
amazon-ec2
amazon-web-services
blockchain
hyperledger-fabric
kubernetes

2 Answers

12/23/2021

Mount a folder/files on an EC2 instance to a pod running in EKS is not supported. For your use case, you can easily share folder/files using EFS if not S3. If you are only allow to do pod to EC2 communication, you need a way for these resources to reach each other either by public IP if not VPC peering. Then you can run sftp, scp... any kind of off the shelf file sharing software you knew best for file exchange.

-- gohm'c
Source: StackOverflow

12/23/2021

You need to connect 2 VPCs with VPC Peering, then you can install NFS in your EC2, and write PV, PVC point to the NFS EC2.

-- Ash Blake
Source: StackOverflow