## 安装 Kube-Scheduler
```
vi /etc/cfssl/k8s/k8s_scheduler.json
{
"CN": "system:kube-scheduler",
"key": {
"algo": "rsa",
"size": 2048
},
"names": [
{
"C": "CN",
"ST": "GuangXi",
"L": "Nanning",
"O": "system:kube-scheduler",
"OU": "Kubernetes-manual"
}
]
}
cd /opt/k8s/ssl/
# 创建证书
cfssl gencert -ca=/etc/pki/k8s/k8s-ca.pem -ca-key=/etc/pki/k8s/k8s-ca-key.pem \
-config=/etc/cfssl/ca-config.json \
-profile=kubernetes /etc/cfssl/k8s/k8s_scheduler.json | cfssljson -bare k8s_scheduler
# 分发证书
cp /opt/k8s/ssl/k8s_scheduler.pem /opt/ssl/k8s/
cp /opt/k8s/ssl/k8s_scheduler-key.pem /opt/ssl/k8s/
# 创建连接配置
kubectl config set-cluster kubernetes \
--certificate-authority=/etc/pki/k8s/k8s-ca.pem \
--embed-certs=true \
--server=https://172.16.0.51:6443 \
--kubeconfig=kube_scheduler.kubeconfig
kubectl config set-credentials system:kube-scheduler \
--client-certificate=/etc/pki/k8s/k8s_scheduler.pem \
--embed-certs=true \
--client-key=/etc/pki/k8s/k8s_scheduler-key.pem \
--kubeconfig=kube_scheduler.kubeconfig
kubectl config set-context kubernetes \
--cluster=kubernetes \
--user=system:kube-scheduler \
--kubeconfig=kube_scheduler.kubeconfig
kubectl config use-context kubernetes --kubeconfig=kube_scheduler.kubeconfig
# 运行 Kube-Scheduler
docker run -it --name kube-scheduler -d --restart=always \
--network=host \
-v /opt/ssl/k8s/kube_scheduler.kubeconfig:/opt/k8s/config \
-v /var/lib/lxcfs/proc/cpuinfo:/proc/cpuinfo:rw \
-v /var/lib/lxcfs/proc/diskstats:/proc/diskstats:rw \
-v /var/lib/lxcfs/proc/meminfo:/proc/meminfo:rw \
-v /var/lib/lxcfs/proc/stat:/proc/stat:rw \
-v /var/lib/lxcfs/proc/swaps:/proc/swaps:rw \
-v /var/lib/lxcfs/proc/uptime:/proc/uptime:rw \
-m 2048m \
-v /var/log/kubernetes/:/var/log/kubernetes/ \
--entrypoint="/usr/local/bin/kube-scheduler" \
gcr.io/google_containers/kube-scheduler:v1.12.1 \
--address=127.0.0.1 \
--leader-elect \
--kubeconfig="/opt/k8s/config" \
--logtostderr \
--alsologtostderr
```