是否可以对特定 EKS Pod 使用特定 AMI?

发布于 2025-01-12 22:12:16 字数 226 浏览 2 评论 0原文

有一种服务与系统中的文件紧密配合,这些文件是静态的,很少变化,其大小约为 70GB。 由于镜像较胖且部署时间较长,现有实施的解决方案(包含 Docker 镜像中的所有这些文件)看起来是错误的解决方案。我正在寻找针对当前问题的最佳解决方案,并且作为一个选项我想知道是否可以使用所有文件创建 AWS AMI 并仅将其用于必要的 Pod?这里使用的是AWS EKS。

提前致谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

樱娆 2025-01-19 22:12:16

根据其他回复,添加 EFS 作为依赖项是一种选择。

对于没有外部依赖项选项的纯 EKS,您需要执行以下操作。

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

温柔戏命师 2025-01-19 22:12:16

对于基于 pod 的映像,您应该根据需要将它们保持在最低限度,以便在创建阶段时它们可以尽快上线。然后,您可以让他们访问共享存储(以实现可扩展性)。至少有两种方法可以实现这一点。

第一种方式是EFS共享文件系统

  • 您可以创建基于EFS的持久卷声明
    存储类并挂载文件系统以供 Pod 使用。
  • 使用 EFS 生命周期功能 - 之后不频繁访问X 天,您可以将很少访问的文件移至较低层以降低成本。

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

第二种方式是S3存储桶

  • 您可以创建一个存储桶来存储对象。
  • 借助 S3 生命周期转换功能,您可以将您很少访问的文件移至较低层,甚至将其存档。

参考:https://aws.amazon.com/premiumsupport /知识中心/eks-restrict-s3-bucket/

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/

傲影 2025-01-19 22:12:16

我想知道是否可以使用所有文件创建 AWS AMI
仅将其用于必要的 pod?

虽然有可能 在这里用示例进行了解释;然后,您将 70GB 内容复制为映像的一部分,并让您的 pod 通过 hostPath 进行访问;但你的最终 ami 可能非常庞大。或者,您可以考虑在 EC2 上运行自己的 NFS 服务器,并提供内容。一种便捷的方法是使用 EFS,其中您的Pod 可以通过 PVC/PV 访问。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文