一步步安装部署kubernetes集群(三)3.4

3.4 部署controller-manager

3.4.1 集群规划

主机名角色IP地址
pg60-21.k8s.host.comcontroller-manager10.20.60.21
pg60-22.k8s.host.comcontroller-manager10.20.60.22
pg60-23.k8s.host.comcontroller-manager10.20.60.23

3.4.2 创建启动脚本

pg60-21.k8s.host.com 虚机实例上操作,另外一台运算节点安装部署方法类似。

shell> cat /opt/kubernetes/server/sbin/kube-controller-manager.sh 
#!/bin/sh
/opt/kubernetes/server/bin/kube-controller-manager   --cluster-cidr 172.60.0.0/16   --leader-elect true   --log-dir /export/kubernetes/logs/kube-controller-manager   --master http://127.0.0.1:8080   --service-account-private-key-file /opt/kubernetes/server/ssl/ca-key.pem   --service-cluster-ip-range 192.168.0.0/16   --root-ca-file /opt/kubernetes/server/ssl/ca.pem   --v 2

shell> chmod +x /opt/kubernetes/server/sbin/kube-controller-manager.sh
shell> mkdir -p /export/kubernetes/logs/kube-controller-manager

3.4.3 在supervisor中创建kube-controller-manager.conf的配置

shell> cat > /opt/supervisor/conf.d/kube-controller-manager.conf << EOF
[program:kube-controller-manager-60-21]
command=/opt/kubernetes/server/sbin/kube-controller-manager.sh
numprocs=1
directory=/opt/kubernetes/server/bin
autostart=true
autorestart=true
startsecs=22
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=10
user=root
redirect_stderr=false
stdout_logfile=/export/kubernetes/logs/kube-controller-manager/controll.stdout.log
stdout_logfile_maxbytes=64MB
stdout_logfile_backups=4
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/export/kubernetes/logs/kube-controller-manager/controll.stderr.log
stderr_logfile_maxbytes=64MB
stderr_logfile_backups=4
stderr_capture_maxbytes=1MB
stderr_events_enabled=false
EOF

3.4.4 启动kube-controller-manager服务并检查

shell> supervisorctl update
kube-controller-manager-60-21: added process group
shell> supervisorctl status
etcd-server-60-21 RUNNING pid 1755, uptime 0:04:39
kube-apiserver-60-21 RUNNING pid 1756, uptime 0:04:39
kube-controller-manager-60-21 RUNNING pid 1832, uptime 0:00:25

相关推荐