6

kubernetes 的挂载传播

 3 years ago
source link: https://jicki.cn/kubernetes-mount-propagation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

kubernetes 的挂载传播 mountPropagation


  • kubernetes 的 mountPropagation 翻译成中文就是挂载传播。挂载传播提供了共享卷挂载的能力, 它允许在同一个 Pod, 甚至同一个节点内, 在多个容器之间共享卷的挂载。 说白了就是 在 容器或 host 内的挂载目录中 再 mount 了一个别的挂载。

  • kubernetes 中 卷的挂载传播由 Container.volumeMountsmountPropagation 字段控制。它的值包含如下三种

    • None: - 这种卷挂载将不会收到任何后续由 host 创建的在这个卷上或其子目录上的挂载。同样的, 由容器创建的挂载在 host 上也是不可见的。这是默认的模式。这个其实很好理解, 就是容器内和 host 的后续挂载完全隔离。

    • HostToContainer: - 这种卷挂载将会收到之后所有的由 host 创建在该卷上或其子目录上的挂载。换句话说, 如果 host 在卷挂载内挂载的任何内容, 在容器中都是可见的。同样, 如果任何具有 Bidirectional 的 Pod 挂载传播到该卷挂载上, 具有 HostToContainer 的挂载传播都可以看见。

    • Bidirectional: - 这种挂载机制和 HostToContainer 类似。此外, 任何在容器中创建的挂载都会传播到 host, 然后传播到使用相同卷的所有 Pod 的所有容器。注意: Bidirectional 挂载传播是很危险的。可能会危害到 host 的操作系统。因此只有特权 securityContext: privileged: true 容器在允许使用它。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK