是否可以对特定 EKS Pod 使用特定 AMI?
有一种服务与系统中的文件紧密配合,这些文件是静态的,很少变化,其大小约为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据其他回复,添加 EFS 作为依赖项是一种选择。
对于没有外部依赖项选项的纯 EKS,您需要执行以下操作。
使用您的依赖项构建您的 AMI
创建专用的 托管节点组 并指定您的 AMI 作为该节点组的源映像。 污染节点组这样只有具有特定容忍度的 pod 才能匹配它
安排您的工作负载,并指定 对 Pod 在节点上调度的污点的容忍度使用正确的 AMI
在 Pod 清单中,指定 hostpath 因此在 Pod 中挂载主机卷
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
对于基于 pod 的映像,您应该根据需要将它们保持在最低限度,以便在创建阶段时它们可以尽快上线。然后,您可以让他们访问共享存储(以实现可扩展性)。至少有两种方法可以实现这一点。
第一种方式是EFS共享文件系统
存储类并挂载文件系统以供 Pod 使用。
参考:https://aws.amazon.com/premiumsupport/knowledge -center/eks-persistent-storage/
第二种方式是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
storage class and mount the file system for pods usage.
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/eks-persistent-storage/
The 2nd way which is S3 bucket
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/eks-restrict-s3-bucket/
虽然有可能 在这里用示例进行了解释;然后,您将 70GB 内容复制为映像的一部分,并让您的 pod 通过 hostPath 进行访问;但你的最终 ami 可能非常庞大。或者,您可以考虑在 EC2 上运行自己的 NFS 服务器,并提供内容。一种便捷的方法是使用 EFS,其中您的Pod 可以通过 PVC/PV 访问。
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.