当前位置:网站首页>Configuration and startup of kubedm series-02-kubelet
Configuration and startup of kubedm series-02-kubelet
2022-07-05 05:30:00 【runzhliu】
List of articles
overview
No matter what control plane The node is still ordinary worker node ,kubelet It is a process that must be started , and kubelet The installation method of can use rpm Packages can also be binary
About kube init About kubelet Start log , Review the
# To start kubelet
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
Default configuration
For the default configuration , We don't need to know every parameter very well , You can check the relevant documents and codes when necessary
# kubeadm config print init-defaults --component-configs KubeletConfiguration
# Excerpts kind: KubeletConfiguration Part of
---
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: cgroupfs
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging: {
}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 0s
shutdownGracePeriodCriticalPods: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
drop in To configure
kubelet There are some special configuration files that need attention , Those who don't understand can check Official documents
Without those package managers , You can refer to the documents installed by hand here
start-up
kubelet The logic that is really started is in the following code , First, try to stop the process ( Prevent multiple processes from starting ), It's essentially passing systemctl status kubelet First check the status of the service , without enable Will remind , If enable It will pass systemctl stop kubelet To stop the service , Then I will ClusterConfiguration and NodeRegistration Parameters of ( Not all , Mainly the parameters for starting the process args And so on KUBELET_KUBEADM_ARGS) Merge , And will write to the default path /var/lib/kubelet/kubeadm-flags.env, Then take it. ClusterConfiguration ( Only aim at kubelet.config.k8s.io) Write to disk /var/lib/kubelet/config.yaml, Finally, through systemctl start kubelet To start the process
// runKubeletStart executes kubelet start logic.
func runKubeletStart(c workflow.RunData) error {
data, ok := c.(InitData)
if !ok {
return errors.New("kubelet-start phase invoked with an invalid data struct")
}
// First off, configure the kubelet. In this short timeframe, kubeadm is trying to stop/restart the kubelet
// Try to stop the kubelet service so no race conditions occur when configuring it
if !data.DryRun() {
klog.V(1).Infoln("Stopping the kubelet")
kubeletphase.TryStopKubelet()
}
// Write env file with flags for the kubelet to use. We do not need to write the --register-with-taints for the control-plane,
// as we handle that ourselves in the mark-control-plane phase
// TODO: Maybe we want to do that some time in the future, in order to remove some logic from the mark-control-plane phase?
if err := kubeletphase.WriteKubeletDynamicEnvFile(&data.Cfg().ClusterConfiguration, &data.Cfg().NodeRegistration, false, data.KubeletDir()); err != nil {
return errors.Wrap(err, "error writing a dynamic environment file for the kubelet")
}
// Write the kubelet configuration file to disk.
if err := kubeletphase.WriteConfigToDisk(&data.Cfg().ClusterConfiguration, data.KubeletDir()); err != nil {
return errors.Wrap(err, "error writing kubelet configuration to disk")
}
// Try to start the kubelet service in case it's inactive
if !data.DryRun() {
fmt.Println("[kubelet-start] Starting the kubelet")
kubeletphase.TryStartKubelet()
}
return nil
}
Take a look
# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.4.1"
# cat /var/lib/kubelet/config.yaml
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: cgroupfs
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
cpuManagerReconcilePeriod: 0s
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMinimumGCAge: 0s
kind: KubeletConfiguration
logging: {
}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 0s
shutdownGracePeriodCriticalPods: 0s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
other
The following is the control plane It is fully started on kubelet After through ps -ef|cat Get the process and parameters
# kubeadm init --upload-certs --image-repository registry.aliyuncs.com/google_containers --kubernetes-version 1.21.7 --pod-network-cidr=10.244.0.0/16
/usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.4.1
边栏推荐
- Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
- SSH password free login settings and use scripts to SSH login and execute instructions
- Solution to the palindrome string (Luogu p5041 haoi2009)
- Use of room database
- 【Jailhouse 文章】Look Mum, no VM Exits
- Warning using room database: schema export directory is not provided to the annotation processor so we cannot export
- Add level control and logger level control of Solon logging plug-in
- [trans]: spécification osgi
- kubeadm系列-00-overview
- Yolov5 ajouter un mécanisme d'attention
猜你喜欢
![[轉]: OSGI規範 深入淺出](/img/54/d73a8d3e375dfe430c2eca39617b9c.png)
[轉]: OSGI規範 深入淺出

剑指 Offer 58 - II. 左旋转字符串

On-off and on-off of quality system construction

SAP method of modifying system table data

挂起等待锁 vs 自旋锁(两者的使用场合)

全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析
![[to be continued] [UE4 notes] L3 import resources and project migration](/img/81/6f75f8fbe60e037b45db2037d87bcf.jpg)
[to be continued] [UE4 notes] L3 import resources and project migration
![[depth first search] 695 Maximum area of the island](/img/08/cfff4aec667216e4f146205a12c13f.jpg)
[depth first search] 695 Maximum area of the island

National teacher qualification examination in the first half of 2022

剑指 Offer 53 - II. 0~n-1中缺失的数字
随机推荐
Find a good teaching video for Solon framework test (Solon, lightweight application development framework)
Haut OJ 1350: choice sends candy
kubeadm系列-01-preflight究竟有多少check
Sword finger offer 04 Search in two-dimensional array
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
How can the Solon framework easily obtain the response time of each request?
Little known skills of Task Manager
用STM32点个灯
剑指 Offer 06.从头到尾打印链表
Sword finger offer 09 Implementing queues with two stacks
Add level control and logger level control of Solon logging plug-in
PC寄存器
kubeadm系列-00-overview
使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor
Haut OJ 1347: addition of choice -- high progress addition
剑指 Offer 53 - II. 0~n-1中缺失的数字
To be continued] [UE4 notes] L4 object editing
【Jailhouse 文章】Look Mum, no VM Exits
Introduction to memory layout of FVP and Juno platforms
Hang wait lock vs spin lock (where both are used)