The role of Kubernetes Scheduler is to bind controller manager to a new pod according to a specific scheduling algorithm and scheduling policy to a suitable node in the cluster, and to write the binding information to the ETCD.
I. Deployment OF Scheduler
The following generates the Kube-scheduler Kubeconfig file, as follows:
cd/etc/kubernetesexport kube_apiserver="https://192.168.15.200:6443"
Configure cluster
Kubectl config set---certificate-authority=/etc/kubernetes/ssl/--embed-certs=true --server=--kubeconfig=scheduler.conf
Configure credentials
Kubectl config set-credentials system:kube---client-certificate=/etc/kubernetes/ssl/-- Embed-certs=true--client-key=/etc/kubernetes/ssl/scheduler---kubeconfig= Scheduler.conf
Configure context
Kubectl config set-context system:kube---cluster=--user=system:kube---kubeconfig= Scheduler.conf
Configure default context
Kubectl config use-context system:[email protected]--kubeconfig=scheduler.conf
Distribute the generated scheduler.conf file to the/etc/kubernetes directory of each Master node, as follows:
SCP scheduler.conf k8s-master02:/etc/kubernetes/ SCP scheduler.conf k8s-master03:/etc/ kubernetes/
Create the Kube-scheduler systemd service startup file as follows:
Export kube_apiserver="https://192.168.15.200:6443"Cat>/usr/lib/systemd/system/kube-scheduler.service <<eof[unit]description=kube-Schedulerafter=Network.targetafter=kube-Apiserver.service [Service]environmentfile=-/etc/kubernetes/Schedulerexecstart=/usr/local/bin/kube-Scheduler--logtostderr=true --v=0 --master=${kube_apiserver}--kubeconfig=/etc/kubernetes/scheduler.conf--leader-elect=trueRestart=on-Failuretype=Simplelimitnofile=65536[Install]wantedby=multi-user.targeteof
Distribute to other hosts:
SCP /usr/lib/systemd/system/kube-scheduler.service k8s-master02:/usr/lib/systemd/system/ SCP /usr/lib/systemd/system/kube-scheduler.service k8s-master03:/usr/lib/systemd/system/
Start the service on each node:
Systemctl daemon-reloadsystemctl enable Kube-schedulersystemctl start kube-Schedulersystemctl Status Kube-scheduler
The Kube-schedule deployment on three Master nodes is completed by electing a leader job.
Review the status of each core component of the Kubernetes Master cluster as follows:
[[Email protected]Master01 kubernetes]# kubectl get csname STATUS MESSAGE Erroretcd-1Healthy {" Health":"true"} Scheduler Healthy OK Controller - manager Healthy OK etcd-0Healthy {" Health":"true"} ETCD-2Healthy {" Health":"true"}
Kubernetes Master Deployment Scheduler and HA Deployment (5)