는 Kubernetes의 자원 할당량

1. 설명
ResourceQuota 객체에 의해, 그것은 각 네임 스페이스에 대한 전반적인 자원 사용 제한 제공 할 수
기본적으로 활성화되어 많은는 Kubernetes 버전에서 지원 자원 할당량을. --admission 제어의 apiserver가 = ResourceQuota 파라미터를 포함 할 때, 자원 할당량을 활성화한다.
네임 스페이스가있는 경우 ResourceQuota 자원 할당량을 시작 네임 스페이스에서 오브젝트. 물체 만 공간에 존재해야 ResourceQuota까지
Kuberners에서, 자원 할당량 자원 (CPU 및 메모리), 메모리 리소스를 산출 할 수 있고, 리소스의 양을 관리 개체.
https://www.kubernetes.org.cn/4905.html

컴퓨팅 자원 관리

1. 네임 스페이스 만들기

kubectl create namespace myspace

2. 본 문서에서, 컴퓨터 자원의 자원 할당량의 이름 YAML 파일 관리 컴퓨팅 자원 할당량을 정의 포드 번호 (4), 코어 CPU 요구량의 수이고, CPU 코어 (2)의 수를 제한하는, 메모리 수요의 크기 1GI는, 메모리는 2Gi의 크기를 제한합니다.

cat >compute-resources.yaml<<EOF
apiVersion: v1 
kind: ResourceQuota 
metadata: 
  name: compute-resources 
spec: 
  hard: 
    pods: "4" 
    requests.cpu: "1" 
    requests.memory: 1Gi 
    limits.cpu: "2" 
    limits.memory: 2Gi
EOF

3.kubectl 명령은 myspaces 네임 스페이스에서 자원 할당량을 만들 수 있습니다

kubectl apply -f ./compute-resources.yaml --namespace=myspace

4. 다음 명령을 실행하여 할당량 자원의 세부 정보를 볼 수 자원 할당량을 생성 한 후 :

kubectl describe quota compute-resources --namespace=myspace

5. 포드 익스플로러 파일을 정의

cat >nginx-deployment.yaml<<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.11
        ports:
        - containerPort: 80
        resources:
          requests:
            cpu: 256m
            memory: 256Mi
          limits:
            cpu: 512m
            memory: 512Mi
EOF

6. 만들기

kubectl apply -f nginx-deployment.yaml --namespace=myspace

7. 자원 할당량을 생성 한 후, 다음 명령을 실행함으로써 리소스 할당 내용을 볼 :

kubectl describe quota compute-resources --namespace=myspace

추천

출처www.cnblogs.com/lovelinux199075/p/11278813.html