스케쥴링은 pod를 어떤 노드위에 배포할까에 대한 기술이나 , 리소스에 대한 제약조건 , 모든 노드에 복제 pod를 항상 실행시키는
Daemonset, 컨트롤 플레인 노드가 아니라 kubelet이 관리하는 Static Pod 등
이러한 개념들에 대한 이야기야.
우선 가장 처음, 어떤 노드위에 pod를 배포할까에 대한 기술을 이야기 해볼까?
제일 많이 쓰는건 Label & Node Selector와 Taint & Toleration 이지 않을까 싶어.
그 아래에 이런것들도 있긴 한데 많이 쓰지는 않는것 같아.
- node Affinity rule , anti Affinity rule
- pod topology spread rule
- nodeName
Assigning Pods to Nodes
You can constrain a Pod so that it is restricted to run on particular node(s), or to prefer to run on particular nodes. There are several ways to do this and the recommended approaches all use label selectors to facilitate the selection. Often, you do not
kubernetes.io
1. Labels &Node Selectors
- Label은 노드에 붙인다.
- Label을 pod 생성시 명시해준다.
- Selector은 Deployment,Replicaset의 속성이며, pod의 Label과 동일해야 한다.
- Selector 와 Label 이 일치하지 않은 경우 에러 발생함
# 조회
#
#
kubectl get pods -l disktype=ssd
# labeling 노드
#
#
kubectl label nodes <your-node-name> disktype=ssd
# pod 변경 label
#
#
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
disktype: ssd
2. Taints and Tolerations
- Taint는 1번 노드에 들어오지마. Toleration은 1번 노드에 들어오게 해줘.
- Toleration를 수정한 pod는 unchage는 안되고 지우고 다시 배포해야 적용됨.
$ kubectl taint nodes node-1 key1=value1:NoSchedule
3. Node Affinity
- node affinity rule은 node Selector 보다는 조금 완곡한 표현이라고 생각하면 됨.
- 우선순위를 정한다고 표현하면 맞으려나?
어떠한 상황에 필요하냐믄, 어떤 노드에 어떤 파드가 배포되었으면 좋겠다고 원할수 있잖아.
예를 들어서 5개 노드중 1개 노드에만 SSD가 장착 되있어, 해당 노드에 리소스를 마니 차지하는 POD가 들어가면 더 좋지.
'컨테이너 > Kubernetes' 카테고리의 다른 글
[Kubernetes] (14) Taints and Tolerations (0) | 2021.08.30 |
---|---|
[Kubernetes] (13) Lables & Selectors (0) | 2021.08.29 |
[Kubernetes] (10) replicaset / replica컨트롤러 (0) | 2021.01.11 |
[Kubernetes] (9) Pod (1) | 2021.01.07 |
[Kubernetes](8) kubeadm으로 k8s 구성(2) (0) | 2021.01.06 |