当前位置:网站首页>How many checks does kubedm series-01-preflight have
How many checks does kubedm series-01-preflight have
2022-07-05 05:30:00 【runzhliu】
We know kubeadm init There will be a lot of preflight The inspection of , These mainly refer to kernel parameters 、 modular 、CRI Etc , If there are any configurations that do not conform Kubernetes The requirements of , Will throw Warning perhaps Error Information about , The following is preflight Main logic of
// Checker validates the state of the system to ensure kubeadm will be
// successful as often as possible.
type Checker interface {
Check() (warnings, errorList []error)
Name() string
}
If there is diy Of check demand , You can inherit this interface in your code Expand , The following is an example. check Example , Obviously ContainerRuntimeCheck It's right CRI That is, the inspection carried out when the container is running
// ContainerRuntimeCheck verifies the container runtime.
type ContainerRuntimeCheck struct {
runtime utilruntime.ContainerRuntime
}
// Name returns label for RuntimeCheck.
func (ContainerRuntimeCheck) Name() string {
return "CRI"
}
// Check validates the container runtime
func (crc ContainerRuntimeCheck) Check() (warnings, errorList []error) {
klog.V(1).Infoln("validating the container runtime")
if err := crc.runtime.IsRunning(); err != nil {
errorList = append(errorList, err)
}
return warnings, errorList
}
The real function of checking is the following function , In fact, it is the host computer that executes crictl info, And receive its return , Old irons might as well run it directly on the host to see the results
// IsRunning checks if runtime is running
func (runtime *CRIRuntime) IsRunning() error {
if out, err := runtime.crictl("info").CombinedOutput(); err != nil {
return errors.Wrapf(err, "container runtime is not running: output: %s, error", string(out))
}
return nil
}
be-all Check There will be small staggered parts inside , For example, check the firewall , First of all Firewall This service does service check, Then the specific port will be checked
Here's all check The statistics of
- CRI: Check whether the container is running
- Service: Check whether the enable and active
- Firewall: Check whether the firewall is closed
- Port: Check whether some ports are released
- Privileged: Check some permissions
- Dir Available: Check whether the directory is valid
- File Available: Check whether the document is valid
- File Existing: Check if the file exists
- File Content: Check whether there is specified content in the file
- In Path: Check whether some executable files are in the specified directory
- Hostname: Check the format of the hostname
- HTTP Proxy: Check if the machine has Proxy Set up
- HTTP Proxy CIDR: Check which addresses of this machine will go Proxy
- System Verification: Check the system version
- Kubernetes Version: Check Kubernetes Version of
- Kubelet Version: Check Kubelet Version of
- SwapCheck: Check Swap Whether to shut down
- External Etcd Version: Check external etcd Version of
- Image Pull: Check whether the image warehouse is connected
- Num CPU: Check the machine CPU Is the quantity in line with kubeadm Minimum requirements for
- Mem: Check whether the local memory conforms to kubeadm Minimum requirements for
When really doing the examination , It will also distinguish between controlplane Or ordinary worker node , The specific checks to be done by different roles are different
Let's see In Path This check , That is to check whether some necessary binary files or commands have been installed , In addition, we have to see mandatory If it is true Words , That is what must be met , Otherwise, it is dispensable , But if not, it will prompt , Users will be advised to install
InPathCheck{
executable: "crictl", mandatory: true, exec: execer},
InPathCheck{
executable: "conntrack", mandatory: true, exec: execer},
InPathCheck{
executable: "ip", mandatory: true, exec: execer},
InPathCheck{
executable: "iptables", mandatory: true, exec: execer},
InPathCheck{
executable: "mount", mandatory: true, exec: execer},
InPathCheck{
executable: "nsenter", mandatory: true, exec: execer},
InPathCheck{
executable: "ebtables", mandatory: false, exec: execer},
InPathCheck{
executable: "ethtool", mandatory: false, exec: execer},
InPathCheck{
executable: "socat", mandatory: false, exec: execer},
InPathCheck{
executable: "tc", mandatory: false, exec: execer},
InPathCheck{
executable: "touch", mandatory: false, exec: execer})
Finally, let's take a look System Verification, Mainly for the host system to carry out some module detection , Let's mainly take a look at Linux Inspection under , Many modules of the kernel have and do not , There is still a big difference , So don't underestimate this part of the inspection , I think the main thing is Linux There is nothing wrong with the system , Sometimes it is precisely this part of the content that is more difficult to check
// DefaultSysSpec is the default SysSpec for Linux
var DefaultSysSpec = SysSpec{
OS: "Linux",
KernelSpec: KernelSpec{
Versions: []string{
`^3\.[1-9][0-9].*$`, `^([4-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}, // Requires 3.10+, or newer
// TODO(random-liu): Add more config
// TODO(random-liu): Add description for each kernel configuration:
Required: []KernelConfig{
{
Name: "NAMESPACES"},
{
Name: "NET_NS"},
{
Name: "PID_NS"},
{
Name: "IPC_NS"},
{
Name: "UTS_NS"},
{
Name: "CGROUPS"},
{
Name: "CGROUP_CPUACCT"},
{
Name: "CGROUP_DEVICE"},
{
Name: "CGROUP_FREEZER"},
{
Name: "CGROUP_PIDS"},
{
Name: "CGROUP_SCHED"},
{
Name: "CPUSETS"},
{
Name: "MEMCG"},
{
Name: "INET"},
{
Name: "EXT4_FS"},
{
Name: "PROC_FS"},
{
Name: "NETFILTER_XT_TARGET_REDIRECT", Aliases: []string{
"IP_NF_TARGET_REDIRECT"}},
{
Name: "NETFILTER_XT_MATCH_COMMENT"},
{
Name: "FAIR_GROUP_SCHED"},
},
Optional: []KernelConfig{
{
Name: "OVERLAY_FS", Aliases: []string{
"OVERLAYFS_FS"}, Description: "Required for overlayfs."},
{
Name: "AUFS_FS", Description: "Required for aufs."},
{
Name: "BLK_DEV_DM", Description: "Required for devicemapper."},
{
Name: "CFS_BANDWIDTH", Description: "Required for CPU quota."},
{
Name: "CGROUP_HUGETLB", Description: "Required for hugetlb cgroup."},
{
Name: "SECCOMP", Description: "Required for seccomp."},
{
Name: "SECCOMP_FILTER", Description: "Required for seccomp mode 2."},
},
Forbidden: []KernelConfig{
},
},
Cgroups: []string{
"cpu", "cpuacct", "cpuset", "devices", "freezer", "memory", "pids"},
CgroupsOptional: []string{
// The hugetlb cgroup is optional since some kernels are compiled without support for huge pages
// and therefore lacks corresponding hugetlb cgroup
"hugetlb",
// The blkio cgroup is optional since some kernels are compiled without support for block I/O throttling.
// Containerd and cri-o will use blkio to track disk I/O and throttling in both cgroup v1 and v2.
"blkio",
},
CgroupsV2: []string{
"cpu", "cpuset", "devices", "freezer", "memory", "pids"},
CgroupsV2Optional: []string{
"hugetlb", "blkio"},
RuntimeSpec: RuntimeSpec{
DockerSpec: &DockerSpec{
Version: []string{
`1\.1[1-3]\..*`, `17\.0[3,6,9]\..*`, `18\.0[6,9]\..*`, `19\.03\..*`, `20\.10\..*`},
GraphDriver: []string{
"aufs", "btrfs", "overlay", "overlay2", "devicemapper", "zfs"},
},
},
}
边栏推荐
- 浅谈JVM(面试常考)
- 使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor
- Service fusing hystrix
- Drawing dynamic 3D circle with pure C language
- Talking about JVM (frequent interview)
- What is the agile proportion of PMP Exam? Dispel doubts
- 每日一题-搜索二维矩阵ps二维数组的查找
- Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
- [转]MySQL操作实战(三):表联结
- GBase数据库助力湾区数字金融发展
猜你喜欢

C language Essay 1

全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析

剑指 Offer 09. 用两个栈实现队列

YOLOv5添加注意力机制

Chapter 6 data flow modeling - after class exercises

National teacher qualification examination in the first half of 2022

object serialization

Palindrome (csp-s-2021-palin) solution
![To be continued] [UE4 notes] L4 object editing](/img/0f/cfe788f07423222f9eed90f4cece7d.jpg)
To be continued] [UE4 notes] L4 object editing

lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
随机推荐
过拟合与正则化
Acwing 4300. Two operations
Hang wait lock vs spin lock (where both are used)
[sum of two numbers] 169 sum of two numbers II - enter an ordered array
记录QT内存泄漏的一种问题和解决方案
Solon Logging 插件的添加器级别控制和日志器的级别控制
Haut OJ 1352: string of choice
注解与反射
National teacher qualification examination in the first half of 2022
Developing desktop applications with electron
每日一题-无重复字符的最长子串
Remote upgrade afraid of cutting beard? Explain FOTA safety upgrade in detail
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
剑指 Offer 05. 替换空格
Download xftp7 and xshell7 (official website)
[es practice] use the native realm security mode on es
Solon 框架如何方便获取每个请求的响应时间?
Fragment addition failed error lookup
Time complexity and space complexity
Binary search basis