Process supervision with Supervisor¶
Supervisor is a process control system utilized in the provided Kubernetes Deployment guide to manage and maintain the state of critical infrastructure components like etcd, API-servers, and schedulers^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
Core Concepts¶
Supervisor operates as a daemon that functions as a parent process for the services it manages^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md]. Its primary role in this context is to ensure that configured processes are automatically restarted if they terminate unexpectedly, thereby maintaining the high availability of the cluster components^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
The tool is typically installed via the yum package manager and started using systemd^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
Configuration¶
Configuration for each managed process is handled via individual ini files located in the /etc/supervisord.d/ directory^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
A standard configuration file includes several key directives that define how the process is treated^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md]:
[program:name]: Defines the identifier for the managed process.command: Specifies the path to the executable script or binary (e.g., an etcd startup script).autostart: A boolean value determining if the process starts when Supervisord starts.autorestart: A boolean value determining if the process restarts automatically if it crashes.startsecs: The total time the process must run to be considered successfully started.startretries: The maximum number of serial startup failure attempts allowed.user: The UNIX account used to run the program.stdout_logfile: The path where standard output logs are stored.redirect_stderr: A boolean to redirect standard error to standard output.
Usage¶
Once the configuration files are created, the supervisorctl command-line tool is used to interact with the Supervisor daemon^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
Common commands include:
* supervisorctl update: Loads new or changed configurations from the configuration directory and applies them^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
* supervisorctl status: Displays the current state (e.g., RUNNING, STOPPED, STARTING) of all managed programs^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md].
Related Concepts¶
- [[DaemonSet]]
- Kubelet
- [[Process lifecycle management]]
Sources¶
^[400-devops__06-Kubernetes__k8s-paas__02.企业部署实战_K8S.md]