2.3.2. 临时存储请求和限值示例


以下示例配置文件显示了一个具有两个容器的 pod:

  • 每个容器请求 2GiB 本地临时存储。
  • 每个容器限制为 4GiB 本地临时存储。
  • 在 pod 级别,kubelet 通过添加该 pod 中所有容器的限制来达到总体 pod 存储限制。

    • 在本例中,pod 级别的总存储使用量是所有容器的磁盘用量总和,以及 pod 的 emptyDir 卷。
    • 因此,pod 的请求为 4GiB 本地临时存储,限值为 8GiB 本地临时存储。

使用配额和限值的临时存储配置示例

apiVersion: v1
kind: Pod
metadata:
  name: frontend
spec:
  containers:
  - name: app
    image: images.my-company.example/app:v4
    resources:
      requests:
        ephemeral-storage: "2Gi" 
1

      limits:
        ephemeral-storage: "4Gi" 
2

    volumeMounts:
    - name: ephemeral
      mountPath: "/tmp"
  - name: log-aggregator
    image: images.my-company.example/log-aggregator:v6
    resources:
      requests:
        ephemeral-storage: "2Gi"
      limits:
        ephemeral-storage: "4Gi"
    volumeMounts:
    - name: ephemeral
      mountPath: "/tmp"
  volumes:
    - name: ephemeral
      emptyDir: {}

1
容器请求本地临时存储。
2
本地临时存储的容器限制。
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部