Home > Software design >  Is it possible to use specific AMI for specific EKS pods?
Is it possible to use specific AMI for specific EKS pods?

Time:03-10

There is a service that works closely with files in the system, those files are static and changed rarely, its size around 70GB. Existing implemented solution with all those files in Docker image looks as wrong solution because of fat image and long deployment time. I am looking for best solution for current problem and as an option I am wondering if it is possible to create AWS AMI with all files and use it only for necessary pods? AWS EKS is being used here.

Thanks in advance!

CodePudding user response:

Adding EFS as a dependency is one option, as per the other replies.

For a pure EKS with no external dependencies option, you'd do the following.

  • Build your AMI with your dependencies in it

  • Create a dedicated managed node group and specify your AMI as the source image for that node group. Taint the node group so that only pods with a specific toleration match it

  • schedule your workload, and specify toleration for your taint to that the pods get scheduled on the nodes with the correct AMI

  • In your pod manifest, specify a hostpath so mount a host volume within the Pod

CodePudding user response:

With your pod based image, you should keep them as minimum as needed so when their creation phase, they can be online as soon as possible. Then, you can let them access the shared storage (for scalability). There are at least 2 ways that you can implement this.

The 1st way which is EFS shared file system

  • You can create a Persistent Volume Claim which is based on EFS storage class and mount the file system for pods usage.
  • With EFS lifecycle feature - Infrequent Access after X days, you can move your rarely access files to lower tier to cut cost.

Reference: https://aws.amazon.com/premiumsupport/knowledge-center/eks-persistent-storage/

The 2nd way which is S3 bucket

  • You can create a bucket to store objects.
  • With S3 lifecycle transition feature, you can move your rarely access files to lower tier or even archive them.

Reference: https://aws.amazon.com/premiumsupport/knowledge-center/eks-restrict-s3-bucket/

CodePudding user response:

I am wondering if it is possible to create AWS AMI with all files and use it only for necessary pods?

While it is possible as explained here with example; where you then copied over your 70GB contents as part of the image and let your pods access via hostPath; but your final ami can be really bulky. Alternately, you can consider running your own NFS server on EC2 and serves the contents. A convenient way for this is using EFS where your pods can access with PVC/PV.

  • Related