8.2. 다중 프로젝트의 리소스 할당량
ClusterResourceQuota 오브젝트에서 정의하는 다중 프로젝트 할당량은 여러 프로젝트에서 할당량을 공유할 수 있습니다. 선택한 각 프로젝트에서 사용하는 리소스를 집계하고 이 집계 정보를 사용하여 선택한 모든 프로젝트의 리소스를 제한합니다.
이 가이드에서는 클러스터 관리자가 다중 프로젝트에서 리소스 할당량을 설정하고 관리하는 방법을 설명합니다.
기본 프로젝트에서 워크로드를 실행하거나 기본 프로젝트에 대한 액세스를 공유하지 마세요. 기본 프로젝트는 핵심 클러스터 구성 요소를 실행하기 위해 예약되어 있습니다.
다음 기본 프로젝트는 높은 권한이 있는 것으로 간주됩니다. default, kube-public, kube-system, openshift, openshift-infra, openshift-node 및 openshift.io/run-level 레이블이 0 또는 1 로 설정된 기타 시스템 생성 프로젝트입니다. Pod 보안 승인, 보안 컨텍스트 제약 조건, 클러스터 리소스 할당량 및 이미지 참조 확인과 같은 승인 플러그인에 의존하는 기능은 높은 권한 있는 프로젝트에서 작동하지 않습니다.
8.2.1. 할당량 생성 중 다중 프로젝트 선택 링크 복사링크가 클립보드에 복사되었습니다!
할당량을 생성할 때 주석 선택이나 라벨 선택 또는 둘 다에 따라 다중 프로젝트를 선택할 수 있습니다.
프로세스
주석에 따라 프로젝트를 선택하려면 다음 명령을 실행합니다.
$ oc create clusterquota for-user \ --project-annotation-selector openshift.io/requester=<user_name> \ --hard pods=10 \ --hard secrets=20이렇게 하면 다음과 같은
ClusterResourceQuota오브젝트가 생성됩니다.apiVersion: quota.openshift.io/v1 kind: ClusterResourceQuota metadata: name: for-user spec: quota:1 hard: pods: "10" secrets: "20" selector: annotations:2 openshift.io/requester: <user_name> labels: null3 status: namespaces:4 - namespace: ns-one status: hard: pods: "10" secrets: "20" used: pods: "1" secrets: "9" total:5 hard: pods: "10" secrets: "20" used: pods: "1" secrets: "9"마찬가지로 라벨에 따라 프로젝트를 선택하려면 다음 명령을 실행합니다.
$ oc create clusterresourcequota for-name \1 --project-label-selector=name=frontend \2 --hard=pods=10 --hard=secrets=20- 1
clusterresourcequota및clusterquota둘 다 동일한 명령의 별칭입니다.for-name은ClusterResourceQuota오브젝트의 이름입니다.- 2
- 라벨에 따라 프로젝트를 선택하려면
--project-label-selector=key=value형식을 사용하여 키-값 쌍을 제공합니다.이렇게 하면 다음과 같은
ClusterResourceQuota오브젝트 정의가 생성됩니다.apiVersion: quota.openshift.io/v1 kind: ClusterResourceQuota metadata: creationTimestamp: null name: for-name spec: quota: hard: pods: "10" secrets: "20" selector: annotations: null labels: matchLabels: name: frontend