Study Memory Work
[K8S/CKA 자격증] Worloads & Scheduling - pod scheduling 본문
pod scheduling
- 특정 pod를 특정 node에서 실행시키고자 할 때 사용한다.
- node label 과 node select를 통해서 운영된다.
- node에 node lable을 설정해두고, deyployment를 이용하여 pod를 생성할 때 nodeSelector에 node label과 같은 value값을 설정해 놓으면, 해당 pod는 해당 lable이 설정되어있는 node에서만 실행된다.
- node lable 관련 명령어
# node의 label 정보 보기
$ kubectl get nodes --show-labels
# node에 label 추가하기
$ kubectl labal {node Name} gpu=true
# label기준으로 node 조회하기
$ kubel get node -L gpu
# label value값 변경하기
$ kubectl labal {node Name} gpu=false --overwrite
# label 삭제하기
$ kubectl labal {node Name} gpu-
- node selector 추가하기
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector: # node label과 같은 kwy,value 넣어주기
gpu: true
[문제10] Pod Scheduling
작업 클러스터 : k8s
다음의 조건으로 pod를 생성하세요.
- Name: eshop-store
- Image: nginx
- Node selector: disktype=ssd
# 1. label 존재여부 체크
$ kubectl get nodes -L disktype
# 2. pod 생성
$ kubectl run eshop-store --image-nginx --dry-run=client -o yaml > eshop.yaml
$ vi eshop.yaml
####
...
spec:
containers:
- name: eshop-store
image: nginx
nodeSelector:
disktype: ssd
...
####
$ kubectl apply -f eshop.yaml
# 3. 확인
$ kubectl get pods -o wide
'Infra > Kubernetes' 카테고리의 다른 글
[K8S/CKA 자격증] Worloads & Scheduling - Secret (0) | 2023.01.22 |
---|---|
[K8S/CKA 자격증] Worloads & Scheduling - ConfigMap (0) | 2023.01.22 |
[K8S/CKA 자격증] Worloads & Scheduling - node 정보보기 (0) | 2023.01.22 |
[K8S/CKA 자격증] Worloads & Scheduling - node 관리 (0) | 2023.01.22 |
[K8S/CKA 자격증] Worloads & Scheduling - Deployment (0) | 2023.01.22 |