Control plane: manage the working nodes and Pod nodes in the cluster
: a group of working machines, called nodes, each cluster has at least one node
pod
: the node will be hosted pod
, pod
which is the basis of all business types and the smallest unit level of K8S management . It is a combination of one or more containers
! [[Pasted image 20230514120922.png]]
Next, let’s talk about the components in the control plane
Control Plane Components
Control the overall situation, such as creating pod
, scheduling resources, etc.
1. to apiserver
Exposes the Kubernetes API responsible for accepting requests
2.kube-scheduler
Responsible for scheduling nodes and monitoring nodes
3.etcd
A consistent and highly available key-value store that serves as the backend database for all Kubernetes cluster data.
4.kube-controller-manager
Responsible for running the controller
controller
- Node Controller: responsible for notifying and responding when a node fails
- Job Controller: monitors Job objects representing one-off tasks, then creates Pods to run those tasks to completion
- Endpoint Slice controller: Populates the Endpoint Slice object (to provide links between Services and Pods).
- Service Account Controller (ServiceAccount controller): Create a default service account (ServiceAccount) for a new namespace.
5.cloud-controller-manager
The cloud controller manager, which connects the cluster to the cloud provider's API and separates the components that interact with that cloud platform from the components that interact with your cluster.
Node (Node) component
The node component will run on each node, responsible for maintaining the running Pod and providing the Kubernetes operating environment
1. Kubelet
Kubelet will run on each node in the cluster to ensure that each container is running pod
, and kubelet will only manage containers created by k8s
2.kube-proxy (proxy)
Refers to the agent running on each node in the cluster, maintaining the network rules on the node
3. Container Runtime
The software responsible for running the container
Addons
DNS
Cluster DNS is a DNS server that works with other DNS servers in the environment to provide DNS records for Kubernetes services.
Web Interface ## What is interface?
interface is an abstract type, which is a collection of methods used to describe the behavior of an object or type
interface source code
interface is divided into two types iface
and eface
, iface
which means a non-empty interface and an empty interface. Let's start with eface
a simple oneeface
eface
type eface struct {
_type *_type
data unsafe.Pointer
}
data is a pointer to object information and the other is _type
a pointer to
_type
type _type struct {
// 类型大小
size uintptr
ptrdata uintptr
// 类型的 hash 值
hash uint32
// 类型的 flag,和反射相关
tflag tflag
// 内存对齐相关
align uint8
fieldalign uint8
// 类型的编号,有bool, slice, struct 等等等等
kind uint8
alg *typeAlg
// gc 相关
gcdata *byte
str nameOff
ptrToThis typeOff
}
Including data type size, memory alignment, hash value, gc related
iface
Different from eface, iface is a non-empty interface, which means that the structure must contain methods, so itab is used internally to encapsulate the type, and a interfacetype
pointer is added
type iface struct {
tab *itab // 表示类型和接口之间的映射
data unsafe.Pointer // 表示接口的值(实际类型的指针)
}
type itab struct {
inter *interfacetype // 接口类型
_type *_type // 实际类型
link *itab // 链接到其他itab,以支持多重继承
hash uint32 // 用于类型判断的哈希值
bad bool // 实际类型是否实现了接口
inhash bool // 是否已将该itab添加到哈希表中
unused [2]byte
fun [1]uintptr // 存储实际类型方法的指针
}
type interfacetype struct {
typ _type // 接口类型的元数据
pkgpath name // 包路径
mhdr []imethod // 接口方法集合
}
Users can manage and troubleshoot applications running in the cluster as well as the cluster itself