티스토리 뷰

반응형

Label 확인

kubectl get nodes --show-labels

 

해당 명령어로 node 별로 설정되어 있는 label을 확인할 수 있으며, 

label의 종류가 꽤나 많습니다...

 

Label 추가

kubectl label node <node_name> <key>=<value>

추가한 후 아래 커맨드로 확인 시 추가 되어 있는 걸 볼 수 있습니다. 

kubectl describe nodes <node_name>

 

Label 삭제

key-만 넣어주면 삭제가 됩니다.

kubectl label nodes <node_name> <key>-

 

Label이 설정이 됬으니 deployment에서 

spec.nodeSelector.<key>.<value> 를 추가하고 배포하면 됩니다. 

apiVersion: apps/v1
kind: Deployment
...
spec:
	containers:
    ...
    nodeSelector:
    	<key>: <value>

 

그 후에 확인을 하려면

kubectl get pods -o wide

 

이 외에 node affinity 라는 명령어도 있습니다.

크게는 아래와 같이 분류 됩니다. 

- requiredDuringSchedulingIgnoredDuringExecution 
- preferredDuringSchedulingIgnoredDuringExecution 
- requiredDuringSchedulingRequiredDuringExecution 
- preferredDuringSchedulingRequiredDuringExecution

 

실제 affinity까지 사용을 해보진 않아서

아직까진 정리가 부족합니다...

더 자세한 사항은 공식 문서로

https://kubernetes.io/ko/docs/concepts/scheduling-eviction/assign-pod-node/

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함
반응형