CKA: 3. Scheduling


Manual scheduling

* before pod is created using nodeName
* POST to pod's Binding API

Affinity and Anti-Affinity

Operators
- In
- NotIn
- Equal
- Exists

Node Affinity Types

- Required During Scheduling, Ignored During Execution 
- Preferred During Scheduling, Ignored During Execution
- Required During Scheduling, Required During Execution (Planned)

Example: 

    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: disktype
            operator: In
            values:
            - ssd 
=========================================
For running pod, one can edit only
  • spec.containers[*].image
  • spec.initContainers[*].image
  • spec.activeDeadlineSeconds
  • spec.tolerations
=========================================

The YAML file for ReplicaSet and DaemonSet are same, except kind. Daemonset is similar to Deployment also. There is no replica , no strategy in Daemonset. Neither (1) replicaset nor (2) daemonset can be created using "kubectl create" command. One need to create Deployment using "kubectl create" command and then remove (1) replica and (2) strategy

=========================================

static pod

pod only. No replicaset. No deployment. No service. 

Add file create pod. The pod will be recreated if crashes. 
Delete file delete pod.
Replace file, restart pod as per new file. 

folder is passed to kubelet as "--pod-manifest-path"
kube-adm uses kubeconfig.yaml file
possible value: /etc/kubernetes/manifests in K8s

Master node has readonly mirror copy of static pod. Static pod cannot be deleted, cannot be modified by kubectl command. Its name will be "pod name"-"node name"

usecase to deploy control plane component. So all control plane pod on master have name : "pod name"-"master node name" Master node name is minikube in case of minikube setup.

Daemonset and static pod, both are ignored by scheduler. 

=========================================

"k describe pod 'pod-name' " in the event section we can see scheduler name. In YAML file we shall mention
schedularName: "NAME OF SCHEDULAR"

copy scheduler pod YAML. it is static pod. so located at /etc/kubernetes/manifest. Then in the command: section add

command:
- --scheduler-name="NAME OF SCHEDULER"
- --lock-object-name="NAME OF SCHEDULER"

Reference: 

https://github.com/kubernetes/community/blob/master/contributors/devel/sig-scheduling/scheduler.md

https://kubernetes.io/blog/2017/03/advanced-scheduling-in-kubernetes/

https://stackoverflow.com/questions/28857993/how-does-kubernetes-scheduler-work

0 comments:

Post a Comment