kubelet简介
The kubelet is the primary “node agent” that runs on each node. The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy.
关于kubelet,官方文档中的说明是这样子的。kubelet主要承担了对Node节点上的Pod的管理工作,包括:从API Server获取Pod信息、与docker进程交互管理容器、监控容器是否正常。同时,kubelt也负责对Node本身和Network进行监控和控制。
kubelet中涉及的名词
- InfraContainer:infrastructure container。Kubelet会为每个Pod先创建一个InfraContainer,同一个Pod中的其他Container共享此容器的Pid、Network、IPC等Namespace及Volumes
- Mirror Pod:Kubelet支持从Api server、文件、URL三种方式获取Pod信息。其中通过后两种方式获取到的Pod称之为Static Pod,Kubelet会为其在Api Server中创建一个Mirror Pod
Other than a PodSpec from the apiserver, there are three ways that a container manifest can be provided to the Kubelet:
File: Path passed as a flag on the command line. This file is rechecked every 20 seconds (configurable with a flag).
HTTP endpoint: HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).
HTTP server: The kubelet can also listen for HTTP and respond to a simple API (underspec’d currently) to submit a new manifest.
- Probe:探针,可以在Pod定义文件中设置的用于检查容器是否健康的命令。可以使用ExecAction、TcpSocketAction、HTTPGetAction
- cAdvisor:kubenetes集成的一个docker资源使用率和性能特性的工具。kubelet在启动时会启动cAdvisor。
kubelet中的Manager
- StatusManager
TODO
Kubelet对Pod的管理
TODO
kubelet对网络的管理
TODO