TGViewer
开发者工具箱|编程·开发工具·资源 开发者工具箱|编程·开发工具·资源 @devtoolboxhub · 883 subscribers
Post #1837 4
Kubernetes v1.37 新增容器存储硬化功能

Kubernetes v1.37 引入了 emptyDir 权限模式bind‑mount 选项,让开发者能在容器内直接控制可写卷的执行与删除权限。
- noexec / nosuid / nodev:防止在可写卷中下载、chmod + x 并执行恶意二进制,提升工作负载安全。
- mode 01777:为共享 writable 目录(如 /tmp)设置粘性位,保证同一 Pod 内不同容器只能删除自己的文件。
- 这些特性目前为 Alpha,需在 API Server 与 kubelet 上开启 VolumeBindMountOptionsEmptyDirVolumeMode

典型用例
- CI/CD 多容器 Pod 共享工作区时,使用 mode: 01777 让各容器只能写入自己的文件。
- 数据库 Pod 的临时存储可设 mode: 0750,仅限数据库用户访问。
- 通过 bindMountOptions: [noexec, nosuid] 防止受损容器在 writable 卷中执行代码。

使用示例
```yaml
apiVersion: v1
kind: Pod
metadata:
name: hardened-bindmount-pod
spec:
containers:
- name: app
image: alpine:latest
command: ["sleep","3600"]
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- name: temp
mountPath: /tmp
bindMountOptions: [noexec, nosuid]
volumes:
- name: temp
emptyDir: {}
```

```yaml
apiVersion: v1
kind: Pod
metadata:
name: hardened-emptydir-pod
spec:
containers:
- name: app
image: alpine:latest
command: ["sleep","3600"]
volumeMounts:
- name: shared
mountPath: /tmp
volumes:
- name: shared
emptyDir:
mode: 01777
```

验证方法
- 在挂载了 noexec 的卷中尝试执行脚本,系统会返回 Permission denied
- 在 mode: 01777 的卷中,非文件所有者无法删除他人文件,返回 Operation not permitted

详细文档请参阅官方 KEP‑5855 与 KEP‑5502。
这些功能适用于 Linux 节点,Windows 节点不受影响。


GitHub: GitHub
GitHub: GitHub

🔗 原文:点击查看
More from @devtoolboxhub
  1. Sep 23, 2026AI reshaping 全球服务外包市场 数十年来,企业扩张运营规模默认方案是将后台工作、一线客户服务和行政支持转移到低成本人力中心。 印度和菲律宾在全球服务贸易中占据了巨大份额…
  2. Sep 23, 2026AI 代理端到端开发工作流 现有AI编码代理能较好完成单个开发任务,但处理包含多个关联任务的完整功能需求时,会遇到任务编排、依赖管理和风险控制等问题。近期有文章提出一套从Epic到…
  3. Sep 22, 20262026年LLM路由工具选型对比 选择LLM路由工具的核心依据是基础设施控制权,而非模型数量。LiteLLM支持100+模型提供商,已经成为混合部署自托管模型与云端模型团队的标准方…
  4. Sep 22, 2026Archify 推出浏览器端交互式图表 Archify 是MIT许可的开源系统图表生成工具,2026年4月创建,截至2026年9月已收获超65000个Star,目前仅以Agent技…
  5. Sep 22, 2026PostgreSQL 参数 max_parallel_apply_workers_per_subscription 解析 max_parallel_apply_workers_pe…
  6. Sep 21, 2026全端离线AI助理新增拒答能力 FamiliaSync 是一款离线优先的加密家庭 organizer 应用,所有数据都存储在用户自有设备中,因此内置助理的所有查询也必须在手机本地运行…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →