管理资源使用
Red Hat OpenShift GitOps 1.16
为 Argo CD 工作负载配置资源请求和限值
摘要
本文档提供了有关使用资源请求和限值配置工作负载的说明。它还讨论如何修补 Argo CD 实例,以在安装后更新所有或任何工作负载的资源要求。
第 1 章 配置资源配额或请求
使用 Argo CD 自定义资源(CR),您可以为 Argo CD 工作负载创建、更新和删除资源请求和限值。
1.1. 使用资源请求和限值配置工作负载
您可以使用资源请求和限值创建 Argo CD 自定义资源工作负载。当您要在配置了资源配额的命名空间中部署 Argo CD 实例时,这是必需的。
以下 Argo CD 实例部署 Argo CD 工作负载,如 Application Controller
、ApplicationSet Controller
、Dex
、Redis
、Repo Server
, 和 Server
,以及带有资源请求和限值的 Server。您还可以以同样的方式创建具有资源要求的其他工作负载。
apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: example spec: server: resources: limits: cpu: 500m memory: 256Mi requests: cpu: 125m memory: 128Mi route: enabled: true applicationSet: resources: limits: cpu: '2' memory: 1Gi requests: cpu: 250m memory: 512Mi repo: resources: limits: cpu: '1' memory: 512Mi requests: cpu: 250m memory: 256Mi dex: resources: limits: cpu: 500m memory: 256Mi requests: cpu: 250m memory: 128Mi redis: resources: limits: cpu: 500m memory: 256Mi requests: cpu: 250m memory: 128Mi controller: resources: limits: cpu: '2' memory: 2Gi requests: cpu: 250m memory: 1Gi
1.2. 修补 Argo CD 实例以更新资源要求
您可在安装后更新所有或任何工作负载的资源要求。
流程
更新 Argo CD 命名空间中的 Argo CD 实例的 Application Controller
资源请求。
oc -n argocd patch argocd example --type='json' -p='[{"op": "replace", "path": "/spec/controller/resources/requests/cpu", "value":"1"}]' oc -n argocd patch argocd example --type='json' -p='[{"op": "replace", "path": "/spec/controller/resources/requests/memory", "value":"512Mi"}]'
1.3. 删除资源请求
您还可以在安装后删除所有或任何工作负载的资源要求。
流程
删除 Argo CD 命名空间中的 Argo CD 实例的 Application Controller
资源请求。
oc -n argocd patch argocd example --type='json' -p='[{"op": "remove", "path": "/spec/controller/resources/requests/cpu"}]' oc -n argocd argocd patch argocd example --type='json' -p='[{"op": "remove", "path": "/spec/controller/resources/requests/memory"}]'
法律通告
Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.