15 Kasım 2022 Salı

Kubernetes Scheduler

Giriş
Açıklaması şöyle. Yeni bir pod'un hangi worker üzerinde çalışacağına karar verir. Buradaki esas nokta sadece karar vermesi
The scheduler here will intelligently decide on which worker node this pod should be placed.
Şeklen şöyle
Açıklaması şöyle
As you see in the diagram, we have an API server, scheduler, controller, and database. When we use the command kubectl to create a resource, we are actually talking to the API server and the API server merely stores the resource in the database. Now, we have a scheduler, which keeps on asking the API server if there are some resources created.

Once the scheduler finds that a pod has to be created, it then inserts into the database via the API server the reference of the node where the pod will be created.

Next, Kubelets running on the various worker nodes start calling the API server and check if any pods have to be created on that particular node. Kubelets are nothing but controllers themselves.

Kendimiz Schedule Etmek İstersek - Manual Scheduling
Açıklaması şöyle
Every POD has a field called nodeName that by default is not set and kube-scheduler sets it on its own. So if one needs to manually schedule a pod, then they just need to set the nodeName property in the pod definition file under the spec section.


**Note: Above method only works when pod is still not created. If the pod is created and already running, then this method won’t work.
Örnek
Açıklaması şöyle
Below is the example of a Pod configuration file, in a scenario where the Pod needs to be manually scheduled on node named “node02”

Whenever the user specify the nodeName property in the Pod’s configuration file. The kube-scheduler detects it and instead of on its own scheduling the Pod, it takes the user choice and schedules the Pod in that specified node. Simple :))
Şöyle yaparız
apiVersion: v1
kind: Pod
metadata:
 name: nginx
 labels:
  name: nginx
spec:
 containers:
 - name: nginx
   image: nginx
   ports:
   - containerPort: 8080
 nodeName: node02


Hiç yorum yok:

Yorum Gönder

Cluster Propotional Autoscaler - ReplicaSet Ekler/Siler

Giriş Açıklaması şöyle CPA aims to horizontally scale the number of Pod replicas based on the cluster’s scale. A common example is DNS ser...