수동 스케줄링 (원하는 노드에 배치)

수동 스케줄링 (원하는 노드에 배치)

728x90

# 수동 스케줄링

- 수동으로 pod를 원하는 node에 수동으로 배치하기

vim http-go.yaml

apiVersion: apps/v1 kind: Pod metadata: name: http-go spec: containers: - name: http-go image: busybox nodeName: work1

kubectl create -f http-go.yaml

* 만약

error: unable to recognize "http-go.yaml": no matches for kind "Pod" in version "apps/v1"

에러가 발생한다면

yaml 파일의 상단의 버전정보를 apiVersion: apps/v1 > apiVersion: v1 변경하여 주면 된다.

# 실행된 pod 확인하기

kubectl get pod kubectl get pod -o wide

- 원하는 노드에 배치된 것을 확인 할 수 있다.

# 레이블링을 통한 수동배치

vim http-go-label.yaml

apiVersion: apps/v1 kind: Pod metadata: name: http-go-gpu spec: containers: - name: http-go image: busybox nodeSelector: gpu: "true"

kubectl create -f http-go-label.yaml 을 실행하면 현재 레이블링이 안되어 있기 때문에 pending 상태로 존재한다.

# 레이블 정보 조회

kubectl get nodes --show-labels

- gpu만 가진 레이블을 조회

kubectl get nodes -L gpu

# work2 배치하기

kubectl label nodes work2 gpu="true" kubectl get nodes -L gpu

- gpu를 다시 확인해보면 work2에만 true가 붙은것을 확인 할 수 있다.

kubectl get nodes -L gpu 를 해보면 이전에 pending 상태였던 pod가 정상적인 상태로 변한것을 볼 수 있다.

728x90

from http://may9noy.tistory.com/275 by ccl(A) rewrite - 2021-09-26 19:26:19