搜索

14.5. 在 Red Hat Quay UI 中建立配额

download PDF

以下流程描述了如何报告存储消耗并建立存储配额限制。

先决条件

  • Red Hat Quay registry。
  • 超级用户帐户。
  • 足够的存储来满足配额限制的需求。

流程

  1. 创建新机构或选择现有机构。最初,没有配置配额,如 Organization Settings 选项卡中显示:

    No Quota Configured

  2. 以超级用户身份登录 registry,再导航到 Super User Admin Panel 上的 Manage Organizations 选项卡。点您要为其创建存储配额限制的机构 Options 图标:

    Organization options

  3. 单击 Configure Quota,再输入初始配额,例如 10 MB。然后点 应用 和关闭

    Initial quota

  4. 检查超级用户面板中的 Manage Organizations 标签页上显示有 0 of 10 MB 的配额:

    Initial consumed quota

    消耗的配额信息也可以在 Organization 页面中直接提供:

    初始消耗的配额

    Initial consumed quota

  5. 若要将配额增加到 100MB,可导航到超级用户面板中的 Manage Organizations 选项卡。单击 Options 图标,再选择 Configure Quota,将配额设置为 100 MB。点 Apply然后关闭

    Increase quota

  6. 输入以下命令拉取示例镜像:

    $ podman pull ubuntu:18.04
  7. 输入以下命令标记示例镜像:

    $ podman tag docker.io/library/ubuntu:18.04 example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:18.04
  8. 输入以下命令将示例镜像推送到机构:

    $ podman push --tls-verify=false example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:18.04
  9. 在超级用户面板中,会显示每个机构消耗的配额:

    Total Quota Consumed for first image

  10. Organization 页面显示镜像使用的配额的总比例:

    第一个镜像消耗的配额总数

    Total Quota Consumed for first image

  11. 输入以下命令拉取第二个示例镜像:

    $ podman pull nginx
  12. 输入以下命令标记第二个镜像:

    $ podman tag docker.io/library/nginx example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/nginx
  13. 输入以下命令将第二个镜像推送到机构:

    $ podman push --tls-verify=false example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/nginx
  14. Organization 页面显示该机构中每个存储库使用的配额的总比例:

    每个仓库消耗的总配额

    Total Quota Consumed for each repository

  15. 创建 rejectwarning 限制:

    从超级用户面板中,导航到 Manage Organizations 选项卡。单击 机构的 Options 图标,再选择 Configure Quota。在 Quota Policy 部分中,将 Action 类型设置为 Reject,将 Quota Threshold 设置为 80,然后单击 Add Limit

    Reject limit

  16. 要创建 警告 限制,请选择 Warning 作为 Action 类型,将 Quota Threshold 设置为 70,然后单击 Add Limit

    Warning limit

  17. 在配额弹出窗口中点 Close。限制可在 Organization 页面的 Settings 选项卡中查看,但不可编辑:

    Quota policy in organization settings

  18. 推送超过 reject 限制的镜像:

    由于 reject 限制(80%)已设置为低于当前存储库大小(~83%),因此下一个推送的镜像会自动被拒绝。

    镜像推送示例

    $ podman pull ubuntu:20.04
    
    $ podman tag docker.io/library/ubuntu:20.04 example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:20.04
    
    $ podman push --tls-verify=false example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org/testorg/ubuntu:20.04

    当超过配额时的输出示例

    Getting image source signatures
    Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
    Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
    Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
    WARN[0002] failed, retrying in 1s ... (1/3). Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
    Getting image source signatures
    Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
    Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
    Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
    WARN[0005] failed, retrying in 1s ... (2/3). Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
    Getting image source signatures
    Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
    Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
    Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
    WARN[0009] failed, retrying in 1s ... (3/3). Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace
    Getting image source signatures
    Copying blob d4dfaa212623 [--------------------------------------] 8.0b / 3.5KiB
    Copying blob cba97cc5811c [--------------------------------------] 8.0b / 15.0KiB
    Copying blob 0c78fac124da [--------------------------------------] 8.0b / 71.8MiB
    Error: Error writing blob: Error initiating layer upload to /v2/testorg/ubuntu/blobs/uploads/ in example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org: denied: Quota has been exceeded on namespace

  19. 超过限制后,UI 中会显示通知:

    配额通知

    Quota notifications

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.