安装部署主控节点控制器/调度器服务
集群规划
主机名 角色 ip
rstx-203.rongbiz.cn controller-manager 192.168.1.203
rstx-204.rongbiz.cn controller-manager 192.168.1.204
rstx-205.rongbiz.cn controller-manager 192.168.1.205
注意:这里部署文档以rstx-203.rongbiz.cn主机为例,另外一台运算节点安装部署方法类似
创建启动脚本: -- 直接上传
rstx-203.rongbiz.cn上
[root@rstx-203 ~]# vi /opt/kubernetes/server/bin/kube-controller-manager.sh
#!/bin/sh
./kube-controller-manager
--cluster-cidr 172.7.0.0/16
--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 10.254.0.0/16
--root-ca-file ./certs/ca.pem
--v 2
[root@rstx-203 ~]# mkdir -p /data/logs/kubernetes/kube-controller-manager
[root@rstx-203 ~]# chmod +x /opt/kubernetes/server/bin/kube-controller-manager.sh
[root@rstx-203 ~]# vi /etc/supervisord.d/kube-conntroller-manager.ini
[program:kube-controller-manager-203]
command=/opt/kubernetes/server/bin/kube-controller-manager.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 ; emit events on stdout writes (default false)
killasgroup=true
stopasgroup=true
[root@rstx-204 supervisord.d]# supervisorctl update
kube-controller-manager-7-22: added process group
[root@rstx-204 supervisord.d]# supervisorctl status
etcd-server-7-122 RUNNING pid 30474, uptime 17:25:13
kube-apiserver-7-122 RUNNING pid 30473, uptime 17:25:13
kube-controller-manager-7-122 RUNNING pid 32962, uptime 0:00:31
安装kube-scheduler
[root@rstx-203 ~]# vi /opt/kubernetes/server/bin/kube-scheduler.sh
#!/bin/sh
./kube-scheduler
--leader-elect
--log-dir /data/logs/kubernetes/kube-scheduler
--master http://127.0.0.1:8080
--v 2
[root@rstx-203 ~]# vi /etc/supervisord.d/kube-scheduler.ini
[program:kube-scheduler-203]
command=/opt/kubernetes/server/bin/kube-scheduler.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-scheduler/scheduler.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 ; emit events on stdout writes (default false)
killasgroup=true
stopasgroup=true
[root@rstx-204 bin]# chmod +x /opt/kubernetes/server/bin/kube-scheduler.sh
[root@rstx-204 bin]# mkdir -p /data/logs/kubernetes/kube-scheduler
[root@rstx-203 ~]# supervisorctl update
[root@rstx-203 bin]# supervisorctl status
etcd-server-203 RUNNING pid 25331, uptime 21:27:51
kube-apiserver-203 RUNNING pid 25679, uptime 18:21:40
kube-controller-manager-203 RUNNING pid 28499, uptime 1:05:44
kube-scheduler-203 RUNNING pid 28397, uptime 1:10:51
[root@rstx-203 bin]# ln -s /opt/kubernetes/server/bin/kubectl /usr/bin/kubectl
[root@rstx-203 bin]# which kubectl
/usr/bin/kubectl
[root@rstx-203 bin]# kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-2 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}
etcd-1 Healthy {"health": "true"}