简体   繁体   English

在 Kubernetes 中挂载一个大文件

[英]Mounting a large file in Kubernetes

We are running a pod in Kubernetes that needs to load a file during runtime.我们在 Kubernetes 中运行一个 pod,它需要在运行时加载一个文件。 This file has the following properties:该文件具有以下属性:

  • It is known at build time在构建时已知
  • It should be mounted read-only by multiple pods (the same kind)它应该由多个 pod(相同类型)以只读方式安装
  • It might change (externally to the cluster) and needs to be updated它可能会更改(在集群外部)并且需要更新
  • For various reasons (security being the main concern) the file cannot be inside the docker image由于各种原因(安全是主要问题),该文件不能位于 docker 映像中
  • It is potentially quite large, theoretically up to 100 MB, but in practice between 200kB - 10MB.它可能非常大,理论上可达 100 MB,但实际上在 200kB - 10MB 之间。

We have considered various options:我们考虑了各种选择:

  • Creating a persistent volume, mount the volume in a temporary pod to write (update) the file, unmount the volume, and then mount it in the service with ROX (Read-Only Multiple) claims.创建持久卷,将卷挂载到临时 pod 中以写入(更新)文件,卸载卷,然后将其挂载到具有 ROX(只读多重)声明的服务中。 This solution means we need downtime during upgrade, and it is hard to automate (due to timings).这个解决方案意味着我们在升级过程中需要停机,而且很难自动化(由于时间问题)。
  • Creating multiple secrets using the secrets management of Kubernetes, and then "assemble" the file before loading it in an init-container or something similar.使用 Kubernetes 的秘密管理创建多个秘密,然后在将文件加载到 init-container 或类似的东西之前“组装”文件。

Both of these solutions feels a little bit hacked - is there a better solution out there that we could utilize for solving this?这两种解决方案都感觉有点被黑了——有没有更好的解决方案可以用来解决这个问题?

You need to use a shared filesystem that supports Read/Write Multiple Pods.您需要使用支持读/写多个 Pod 的共享文件系统。 Here is a link to the CSI Drivers which can be used with Kubernetes and provide those access: https://kubernetes-csi.github.io/docs/drivers.html Here is a link to the CSI Drivers which can be used with Kubernetes and provide those access: https://kubernetes-csi.github.io/docs/drivers.html

Ideally, you need a solution that is not an appliance, and can run anywhere meaning it can run in the cloud or on-prem.理想情况下,您需要一个不是设备的解决方案,并且可以在任何地方运行,这意味着它可以在云中或本地运行。

The platforms that could work for you are Ceph, GlusterFS, and Quobyte ( Disclaimer, I work for Quobyte )可以为您工作的平台是 Ceph、GlusterFS 和 Quobyte(免责声明,我为 Quobyte 工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过Kubernetes在Docker容器中挂载Azure文件存储 - Mounting Azure File Storage in Docker container via Kubernetes Kubernetes docker 卷挂载选项 - Kubernetes docker volume mounting option Kubernetes 在 WSL2 中安装文件夹 - Kubernetes mounting folders in WSL2 将Windows共享安装到Kubernetes容器中 - Mounting a Windows Share into Kubernetes pods 将机密安装为文件而不是将其作为环境变量通过Kubernetes上的Docker传递时是否有安全优势? - Is there any security advantage to mounting secrets as a file instead of passing them as environment variables with Docker on Kubernetes? 将 SMB 或 NFT Azure 文件共享挂载到 kubernetes 上的 JupyterHub 以获取共享目录 - Mounting an SMB or NFT Azure File share onto JupyterHub on kubernetes for a shared directory Kubernetes - 不能在 Azure 文件共享上安装 Windows 路径(Linux 安装工作正常) - Kubernetes - cannot have Windows path mounted on Azure File Share (Linux mounting works properly ) 挂载路径会在 kubernetes 中创建一个新目录 - Mounting a path creates a new directory in kubernetes 使用卷挂载文件 - Using volume for mounting a file 挂载gcePersistentDisk kubernetes卷非常慢 - Mounting a gcePersistentDisk kubernetes volume is very slow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM