본문 바로가기
IT 잡지식/DevOps

[CKA] KodeKloud - Multiple Schedulers

by 쯀리♥️ 2024. 6. 23.

 

 

안녕하세요, 쯀리입니다.

오늘은 Multiple Schedulers에 관해 알아볼게요

 

https://kubernetes.io/ko/docs/tasks/extend-kubernetes/configure-multiple-schedulers/

 

다중 스케줄러 설정

쿠버네티스는 여기에서 설명한 스케줄러를 기본 스케줄러로 사용한다. 만일 기본 스케줄러가 사용자의 필요를 만족시키지 못한다면 직접 스케줄러를 구현하여 사용할 수 있다. 이에 더해, 기본

kubernetes.io

 

 


Quiz.

1. What is the name of the POD that deploys the default kubernetes scheduler in this environment?

controlplane ~ ➜  k get pods -A | grep scheduler
kube-system    kube-scheduler-controlplane            1/1     Running   0          6m34s


kube-scheduler-controlplane

2. What is the image used to deploy the kubernetes scheduler?
Inspect the kubernetes scheduler pod and identify the image

 k describe pods kube-scheduler-controlplane -nkube-system

registry.k8s.io/kube-scheduler:v1.30.0

 

3. We have already created the ServiceAccount and ClusterRoleBinding that our custom scheduler will make use of.

Checkout the following Kubernetes objects:

ServiceAccount: my-scheduler (kube-system namespace)
ClusterRoleBinding: my-scheduler-as-kube-scheduler
ClusterRoleBinding: my-scheduler-as-volume-scheduler

Run the command: kubectl get serviceaccount -n kube-system and kubectl get clusterrolebinding

Note: - Don't worry if you are not familiar with these resources. We will cover it later on.
 kubectl get serviceaccount -n kube-system
 kubectl get clusterrolebinding

 

4. Let's create a configmap that the new scheduler will employ using the concept of ConfigMap as a volume.
We have already given a configMap definition file called my-scheduler-configmap.yaml at /root/ path that will create a configmap with name my-scheduler-config using the content of file /root/my-scheduler-config.yaml.

 

controlplane ~ ➜  k apply -f my-scheduler-configmap.yaml
configmap/my-scheduler-config created

controlplane ~ ➜  k get configmap -A
NAMESPACE         NAME                                                   DATA   AGE
...
kube-system       my-scheduler-config

 

5. Deploy an additional scheduler to the cluster following the given specification.
Use the manifest file provided at /root/my-scheduler.yaml. Use the same image as used by the default kubernetes scheduler.

Name: my-scheduler
Status: Running
Correct image used?
controlplane ~ ➜  k apply -f my-scheduler.yaml 
pod/my-scheduler created

controlplane ~ ➜  k get pods -A | grep my-scheduler
kube-system    my-scheduler                           0/1     InvalidImageName   0          21s

이미지가 정상적이지 않은 이름인가 보네요

이미지를 변경해주겠습니다.     image: registry.k8s.io/kube-scheduler:v1.30.0 

controlplane ~ ➜  vi my-scheduler.yaml 

controlplane ~ ➜  k apply -f my-scheduler.yaml 
pod/my-scheduler configured

controlplane ~ ➜  k get pods
No resources found in default namespace.

controlplane ~ ➜  k get pods -A | grep my-scheduler
kube-system    my-scheduler                           1/1     Running   0          3m31s

 

 

6. A POD definition file is given. Use it to create a POD with the new custom scheduler.

File is located at /root/nginx-pod.yaml

Uses custom scheduler
Status: Running

nginx.yaml파일을 이전에 생성해둔 scheduler로 설정해주겠습니다. 

apiVersion: v1
kind: Pod 
metadata:
  name: nginx
spec:
  schedulerName: my-scheduler
  containers:
  - image: nginx
    name: nginx
k create -f nginx.yaml

오늘은 간단하게 다중 스케쥴러가 어떻게 사용되는지에 대해 알아보았습니다. 

다음시간에는 Logging과 Monitoring에 관해 알아보도록 하겠습니다. 

 

 


참조

Udemy Labs - Certified Kubernetes Administrator with Practice Tests