controller-manager的安裝
kube-controller-manager不需要簽發(fā)證書
- 創(chuàng)建controller-manager啟動(dòng)腳本,并添加執(zhí)行權(quán)限
[root@node2 bin]# cat kube-controller-manager-startup.sh
#!/bin/sh
WORK_DIR=$(dirname $(readlink -f $0))
[ $? -eq 0 ] && cd $WORK_DIR || exit
/opt/kubernetes/server/bin/kube-controller-manager \
--cluster-cidr 172.27.0.0/24 \
--leader-elect true \
--log-dir /data/logs/kubernetes/kube-controller-manager \
--master http://127.0.0.1:8080 \
--service-account-private-key-file ./certs/ca-key.pem \
--service-cluster-ip-range 192.168.0.0/16 \
--root-ca-file ./certs/ca.pem \
--v 2
- 創(chuàng)建supervisor管理腳本
[root@node2 bin]# cat /etc/supervisord.d/kube-controller-manager.ini
[program:kube-controller-manager-node2]
command=/opt/kubernetes/server/bin/kube-controller-manager-startup.sh ; the program (relative uses PATH, can take args)
numprocs=1 ; number of processes copies to start (def 1)
directory=/opt/kubernetes/server/bin ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs=30 ; number of secs prog must stay running (def. 1)
startretries=3 ; max # of serial start failures (default 3)
exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
user=root ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/data/logs/kubernetes/kube-controller-manager/controller.stdout.log ; stderr log path, NONE for none; default AUTO
stdout_logfile_maxbytes=64MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=4 ; # of stdout logfile backups (default 10)
stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
stdout_events_enabled=false
[root@node2 bin]# chmod +x kube-controller-manager-startup.sh
- 創(chuàng)建kube-controller-manager日志目錄
[root@node2 bin]# mkdir -p /data/logs/kubernetes/kube-controller-manager
- 使用supervisorctl管理kube-controller-manager服務(wù)。
[root@node2 bin]# supervisorctl update
[root@node2 bin]# supervisorctl status
etcd-server-node2 RUNNING pid 32189, uptime 22:15:16
kube-apiserver-node2 RUNNING pid 32188, uptime 22:15:16
kube-controller-manager-node2 STARTING
scheduler的安裝和配置
- scheduler不需要簽發(fā)證書
- 創(chuàng)建scheduler的啟動(dòng)腳本
[root@node2 bin]# cat kube-scheduler-startup.sh
#!/bin/sh
WORK_DIR=$(dirname $(readlink -f $0))
[ $? -eq 0 ] && cd $WORK_DIR || exit
/opt/kubernetes/server/bin/kube-scheduler \
--leader-elect \
--log-dir /data/logs/kubernetes/kube-scheduler \
--master http://127.0.0.1:8080 \
--v 2
- 創(chuàng)建supervisor管理腳本
[root@node2 bin]# cat /etc/supervisord.d/kube-scheduler.ini
[program:kube-scheduler-node2]
command=/opt/kubernetes/server/bin/kube-scheduler-startup.sh
numprocs=1
directory=/opt/kubernetes/server/bin
autostart=true
autorestart=true
startsecs=30
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=10
user=root
redirect_stderr=true
stdout_logfile=/data/logs/kubernetes/kube-scheduler/scheduler.stdout.log
stdout_logfile_maxbytes=64MB
stdout_logfile_backups=4
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
[root@node2 bin]# chmod u+x /opt/kubernetes/server/bin/kube-scheduler-startup.sh
- 創(chuàng)建kube-scheduler日志目錄
[root@node2 bin]#
- 檢查主控節(jié)點(diǎn)狀態(tài)
[root@node2 bin]# supervisorctl status
etcd-server-node2 RUNNING pid 32189, uptime 1 day, 1:22:15
kube-apiserver-node2 RUNNING pid 32188, uptime 1 day, 1:22:15
kube-controller-manager-node2 RUNNING pid 1602, uptime 3:07:04
[root@node3 bin]# supervisorctl status
etcd-server-node3 RUNNING pid 26427, uptime 0:02:53
kube-apiserver-node3 RUNNING pid 26426, uptime 0:02:53
kube-controller-manager-node3 RUNNING pid 26428, uptime 0:02:53
kube-scheduler-node3 STARTING
[root@node3 bin]# ./kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-1 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}
etcd-2 Healthy {"health": "true"}