꼭 실행되어야만 하는 Pod A가 새로 등록되었을때 노드가 꽉차있다면 scheduler는 가장 필요없는 Pod B를 제거하여 A를 실행시킬 수 있도록 해야한다.
이때 이 Pod의 중요도를 Pod Priority라고 하고 PriorityClass를 통해 설정할 수 있다.
•
PriorityClass는 Pod의 중요도를 지정하는 리소스로 다음과 같이 작성한다.
◦
value: 숫자가 클수록 우선순위 높음
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000000
globalDefault: false
description: This priority class should be used for XYZ service pods only.
YAML
복사
•
이 Priority Class를 가진 Pod는 value값이 매우 높은 중요도를 가지게 된다.
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
priorityClassName: high-priority
YAML
복사
•
축출 당하지는 않지만 다른 pod를 밀쳐내지는 않도록 하기 위해선 다음과 같이 설정하면 된다.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000000 # <- 높은 우선순위로 다른 pod에게 축출 당하지 않지만
globalDefault: false
preemptionPolicy: Never # <- 다른 pod를 축출 금지
description: This priority class should be used for XYZ service pods only.
YAML
복사