Kubernetes v1.30:只读卷挂载可以实现只读了

默认情况下,只读卷装载并不是真正的只读

---
apiVersion: v1
kind: Pod
spec:
  volumes:
    - name: mnt
      hostPath:
        path: /mnt
  containers:
    - volumeMounts:
        - name: mnt
          mountPath: /mnt
          readOnly: true

/mnt 下的任何子挂载仍然是可写的!

Kubernetes 1.30 添加了一个新的挂载选项 recursiveReadOnly,以使子挂载递归只读。

---
apiVersion: v1
kind: Pod
spec:
  volumes:
    - name: mnt
      hostPath:
        path: /mnt
  containers:
    - volumeMounts:
        - name: mnt
          mountPath: /mnt
          readOnly: true
          # NEW
          # 可能的值为 `Enabled`、`IfPossible` 和 `Disabled`。
          # 需要与 `readOnly: true` 一起指定。
          recursiveReadOnly: Enabled

要获得正确的递归只读挂载,你必须设置这两个字段。

要启用 recursiveReadOnly 挂载,必须使用以下组件:

  • Kubernetes:v1.30 或更新版本,并启用 RecursiveReadOnlyMounts 特性门控。从 v1.30 开始,此特性被标记为 Alpha。

  • CRI 运行时:

    • containerd:v2.0 或更新版本

  • OCI 运行时:

    • runc:v1.1 或更新版本

    • crun: v1.8.6 或更新版本

  • Linux 内核: v5.12 或更新版本

Kubernetes SIG Node 希望并期望该特性将在 Kubernetes 的未来版本中升级为 Beta 版本并最终稳定可用(GA),以便用户不再需要手动启用此特性门控。

相关推荐

  1. Kubernetes v1.30:挂载可以实现

    2024-07-20 22:02:02       19 阅读
  2. lua

    2024-07-20 22:02:02       45 阅读
  3. c# 让文件

    2024-07-20 22:02:02       46 阅读
  4. sqlite3 jdbc 模式

    2024-07-20 22:02:02       53 阅读
  5. postgresql创建权限的用户

    2024-07-20 22:02:02       13 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-20 22:02:02       52 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-20 22:02:02       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-20 22:02:02       45 阅读
  4. Python语言-面向对象

    2024-07-20 22:02:02       55 阅读

热门阅读

  1. Unity运行时节点编辑器——互动电影案例

    2024-07-20 22:02:02       18 阅读
  2. flask渲染页码

    2024-07-20 22:02:02       17 阅读
  3. 23年oppo提前批B组笔试真题-小欧的卡牌

    2024-07-20 22:02:02       18 阅读
  4. Django已经登录但是还是提示登录

    2024-07-20 22:02:02       17 阅读
  5. Go语言入门之函数

    2024-07-20 22:02:02       18 阅读
  6. swift小知识点

    2024-07-20 22:02:02       14 阅读
  7. 项目中MyBatis要引入的内容

    2024-07-20 22:02:02       17 阅读
  8. ccf-csp认证--仓库规划

    2024-07-20 22:02:02       17 阅读