ㅁ Deploy Additional Scheduler
wget https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kube-scheduler
kube-scheduler.service
ExecStart=/usr/local/bin/kube-scheduler \\
--config=/etc/kubernetes/config/kube-scheduler.yaml \\
--scheduler-name=default-scheduler
my-custom-scheduler.service
ExecStart=/usr/local/bin/kube-scheduler \\
--config=/etc/kubernetes/config/kube-scheduler.yaml \\
--scheduler-name=my-custom-scheduler
ㅁ Deploy Additional Scheduler - kubeadm
/etc/kubernetes/manifests/kube-scheduler.yaml
apiVersion: v1
kind: Pod
metadata:
name: kube-scheduler
namespace: kube-system
spec:
containers:
- command:
- kube-scheduler
- --address=127.0.0.1
- --kubeconfig=/etc/kubernetes/scheduler.conf
- --leader-elect=true
image: k8s.gcr.io./kube-scheduler-amd64:v1.11.3
name: kube-scheduler
my-custom-scheduler.yaml
apiVersion: v1
kind: Pod
metadata:
name: my-custom-scheduler
namespace: kube-system
spec:
containers:
- command:
- kube-scheduler
- --address=127.0.0.1
- --kubeconfig=/etc/kubernetes/scheduler.conf
- --leader-elect=true
- --scheduler-name=my-custom-scheduler
- --lock-object-name=my-custom-scheduler
image: k8s.gcr.io/kube-scheduler-amd64:v1.11.3
name: kube-scheduler
View Schedulers
새로 생성된 스케줄러(my-custom-scheduler)로 새로운 Pod를 생성하려면
spec.schedulerName: <mu-custom-scheduler>를 지정해 줘야 한다.
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
conatiners:
- image: nginx
name: nginx
schedulerName: my-custom-scheduler
로 정의하여 생성한다.
kubectl get events
kubectl logs my-custom-scheduler --name-space=kube-system
[Practice Test]
ㅁ What is the name of the POD that deploys the default kubernetes scheduler in this environment?
kubectl get pods --namespace=kube-system
ㅁ What is the image used to deploy the kubernetes scheduler?
kubectl describe pod kube-scheduler-controlplane --namespace=kube-system | grep -i Image
ㅁ Deploy an additional scheduler to the cluster following the given specification.
- Namespace: kube-system
- Name: my-scheduler
- Status: Running
- Custom Scheduler Name
cd /etc/kubernetest/manifests/
ls
cp kube-scheduler.yaml /root/my-scheduler.yaml
cd
pwd
my-scheduler.yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ""
creationTimestamp: null
labels:
component: my-scheduler
tier: control-plane
name: my-scheduler
namespace: kube-system
spec:
containers:
- command:
- kube-scheduler
- --address=127.0.0.1
- --kubeconfig=/etc/kubernetes/scheduler.conf
- --leader-elect=false
- --port=10282
- --scheduler-name=my-scheduler
- --secure-port=0
image: k8s.gcr.io/kube-scheduler-amd64:v1.16.0
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 8
httpGet:
host: 127.0.0.1
path: /healthz
port: 10282
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 15
name: kube-scheduler
resources:
requests:
cpu: 100m
volumeMounts:
- mountPath: /etc/kubernetes/scheduler.conf
name: kubeconfig
readOnly: true
hostNetwork: true
priorityClassName: system-cluster-critical
volumes:
- hostPath:
path: /etc/kubernetes/scheduler.conf
type: FileOrCreate
name: kubeconfig
status: {}
kubectl create -f my-scheduler.yaml
ㅁ A POD definition file is given. use it to create a POD with the new custom scheduler.
- name: nginx
- Users custom scheduler
- Status: Running
/root/nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
schedulerName: my-scheduler
containers:
- image: nginx
name: nginx
kubectl create -f nginx-pod.yaml
watch "kubectl get pods"
kubectl describe pod nginx
'CKA &. CKAD > Scheduling' 카테고리의 다른 글
Application Logs (0) | 2021.03.26 |
---|---|
Configuring Kubernetes Scheduler (0) | 2021.03.26 |
Practice Test - Static Pods (0) | 2021.03.26 |
Practice Test - Daemon Sets (0) | 2021.03.26 |
Practice Test - Resource Limits (0) | 2021.03.26 |