zoukankan      html  css  js  c++  java
  • k8s之Controller Manager(七)

    Controller Manager简介

    详细介绍请参考链接:Kubernetes组件之kube-controller-manager

    Controller Manager作为集群内部的管理控制中心,负责集群内的Node、Pod副本、服务端点(Endpoint)、命名空间(Namespace)、服务账号(ServiceAccount)、资源定额(ResourceQuota)的管理,当某个Node意外宕机时,Controller Manager会及时发现并执行自动化修复流程,确保集群始终处于预期的工作状态。

     

     

    每个Controller通过API Server提供的接口实时监控整个集群的每个资源对象的当前状态,当发生各种故障导致系统状态发生变化时,会尝试将系统状态修复到“期望状态”。

    1 hdss7-21安装controller managet

    [root@hdss7-21 conf]#  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 ./cert/ca-key.pem 
      --service-cluster-ip-range 192.168.0.0/16 
      --root-ca-file ./cert/ca.pem 
      --v 2
     [root@hdss7-21 conf]# vi /etc/supervisord.d/kube-conntroller-manager.ini
    
    [program:kube-controller-manager-7-21]
    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
    [root@hdss7-21 conf]# chmod +x /opt/kubernetes/server/bin/kube-controller-manager.sh
    [root@hdss7-21 conf]# mkdir -p /data/logs/kubernetes/kube-controller-manager
    [root@hdss7-21 conf]# supervisorctl status
    etcd-server-7-21                 RUNNING   pid 2753, uptime 1:57:06
    kube-apiserver-7-21              RUNNING   pid 2873, uptime 1:04:39
    kube-controller-manager-7-21     RUNNING   pid 2987, uptime 0:02:06
    [root@hdss7-21 conf]# 
    

    2.hdss7-22安装controller managet

    [root@hdss7-22 conf]# cat /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 ./cert/ca-key.pem 
      --service-cluster-ip-range 192.168.0.0/16 
      --root-ca-file ./cert/ca.pem 
      --v 2
    [root@hdss7-22 conf]# chmod +x /opt/kubernetes/server/bin/kube-controller-manager.sh
    [root@hdss7-22 conf]#  mkdir -p /data/logs/kubernetes/kube-controller-manager
    [root@hdss7-22 conf]# cat /etc/supervisord.d/kube-conntroller-manager.ini
    [program:kube-controller-manager-7-22]
    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)
    [root@hdss7-22 conf]# supervisorctl update
    [root@hdss7-22 conf]# supervisorctl status
    

    原文章已同步语雀
    https://www.yuque.com/songyifei/bkxwl0/hvsvvo
  • 相关阅读:
    工具类-ApplicationContextUtil
    银行联行号-全国地区码
    银行联行号-银行编码(联行号前3位)
    前端防止 JS 调试技巧
    Vue基础框架
    关于5G手机使用4G套餐扫盲
    nginx高级-前端必会
    懒人npm运行和打包命令
    关于虚拟专用网络的一些经验
    JS加密解密
  • 原文地址:https://www.cnblogs.com/sseban/p/13055406.html
Copyright © 2011-2022 走看看