当前位置:网站首页>Static Pod, Pod Creation Process, Container Resource Limits
Static Pod, Pod Creation Process, Container Resource Limits
2022-08-01 08:02:00 【GottdesKrieges】
静态Pod
Static containers have the following characteristics:
- Pod由特定节点上的kubelet管理;
- 不能使用控制器;
- Pod名称标识当前节点名称.
在kubeletThe configuration file to enable staticPod的参数:
vi /var/lib/kubelet/config.yaml
...
staticPodPath: /etc/kubernetes/manifests
将部署的pod.yamlplaced in this directory will bekubelet自动创建.
K8S组件中除了kubeletOutside are running in the form of container.在K8SBefore the cluster is set up,Only by the above methodkubelet创建静态Pod.
MasterThe components deployed by the node areapi-server、controller-manager、scheduler和etcd;NodeThe components deployed by the node arekube-proxy、kubelet和docker.
[[email protected] ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-5c64b68895-kthkh 1/1 Running 4 (6h16m ago) 8d
calico-node-6mxfm 1/1 Running 4 (6h16m ago) 8d
calico-node-nzn8p 1/1 Running 150 (6h16m ago) 8d
calico-node-vg6s9 1/1 Running 4 (6h16m ago) 8d
coredns-6d8c4cb4d-k9245 1/1 Running 4 (6h16m ago) 8d
coredns-6d8c4cb4d-xzl49 1/1 Running 4 (6h16m ago) 8d
etcd-k8s-master 1/1 Running 4 (6h16m ago) 8d
kube-apiserver-k8s-master 1/1 Running 4 (6h16m ago) 8d
kube-controller-manager-k8s-master 1/1 Running 4 (6h16m ago) 8d
kube-proxy-58kfs 1/1 Running 5 (6h16m ago) 8d
kube-proxy-75z28 1/1 Running 4 (6h16m ago) 8d
kube-proxy-f9522 1/1 Running 4 (6h16m ago) 8d
kube-scheduler-k8s-master 1/1 Running 4 (6h16m ago) 8d
metrics-server-798c598bb8-j69cc 1/1 Running 3 (6h16m ago) 6d19h
[[email protected] ~]# kubectl get deploy -n kube-system
NAME READY UP-TO-DATE AVAILABLE AGE
calico-kube-controllers 1/1 1 1 8d
coredns 2/2 2 2 8d
metrics-server 1/1 1 1 6d19h
可以发现,etcd-k8s-master、kube-apiserver-k8s-master、kube-controller-manager-k8s-master、kube-scheduler-k8s-master都是以masterThe name of the node ends with,And there is no corresponding controller.
实际上,masterThese four components of the node are all generated by this nodekubelet直接管理的静态Pod部署.
[[email protected] ~]# grep staticPod /var/lib/kubelet/config.yaml
staticPodPath: /etc/kubernetes/manifests
[[email protected] ~]#
[[email protected] ~]# ls /etc/kubernetes/manifests/
etcd.yaml kube-apiserver.yaml kube-controller-manager.yaml kube-scheduler.yaml
Pod创建流程
k8s基于list-watch机制的控制器架构,实现组件间交互的解耦.其他组件监控自己负责的资源,当这些资源发生变化时,kube-apiserver会通知这些组件,这个过程类似于发布与订阅.
from the moment we issue the command,一个PodThe general process that is created is as follows:
- 所有使用
kubectlCommands issued are sent toapi-server,The latter after receiving the writtenetcd中. etcdWrite successfullyapi-serverReturn to write the message of success,否则会返回错误信息.api-serverNotify the schedulerscheduler把要创建的Pod分配到合适的节点上.schedulerChoose good after the target node,打上标记,and report the results toapi-server.api-server收到scheduler反馈的Pod-Node绑定信息后,将其写入etcd.api-server通知目标node节点上的kubelet组件创建Pod.- 目标节点上的
kubelet组件调用dockeror other container engines to create containers,and report the creation result information toapi-server. api-server将收到的PodCreate result information writeetcd.
Since creating a separatePodwill not use the controller,So the above process does not involvecontroller-manager.此外,也没有创建Service,So it doesn't involvekube-proxy组件.
容器资源限制
Use the following two properties to limit what the container can useCPU和内存资源的上限:
resources.limits.cpuresources.limits.memory
Set the minimum resource requirements used by the container through the following two properties(下限),作为容器调度时资源分配的依据:
resources.requests.cpuresources.requests.memory
k8s会根据requestsvalue to find nodes with enough available resources to schedulePod.
注意事项:
- When no resource limit is configured,The container can use all the resources of the node where it is located.
- limitsGenerally lower than the node configuration20%.
- requests的值必须小于limits,一般低于limits的20%到30%.
- 只设置limits限制时,requestsBy default alsolimits的值.
- requestsis a reserved resource,The actual resources used when the container is running may be less thanrequests.
- 如果requests配置过高,will result in node allocationPod过少,will lead to idle resources.
- 如果requests配置过低,will result in node allocationPod过多,Saturation may lead to resources.
- CPUThe unit of measure for resources is millicores,1核CPU=1000m,0.5=500m.
View the allocation of resources of the current node(Allocated resources):
kubectl describe node k8s-node1
边栏推荐
- various network protocols
- Golang:go模版引擎的使用
- Flink SQL - client, how to deal with the source side and to increase the target, the SQL - client including mapping table and the JOB such as
- my creative day
- Delphi MDI appliction 文档最大化显示、去掉最大化最小化等按钮
- VoLTE基础学习系列 | 企业语音网简述
- 【STM32】入门(一):环境搭建、编译、下载、运行
- 特殊的日子,值得纪念
- 并发编程13-JUC之CountDownLatch
- VoLTE Basic Learning Series | Enterprise Voice Network Brief
猜你喜欢
随机推荐
Go supports OOP: use struct instead of class
华为深度学习课程第六、七章
Fist game copyright-free music download, League of Legends copyright-free music, can be used for video creation, live broadcast
VoLTE Basic Learning Series | Enterprise Voice Network Brief
热修复技术可谓是百花齐放
special day to remember
POJ1251丛林之路题解
pytest接口自动化测试框架 | parametrize叠加使用
Pytest | skip module interface test automation framework
POJ2421道路建设题解
数据分析5
zip package all files in the directory (including hidden files/folders)
网络基础学习
Summary of test points about app updates in different ways
22牛客多校1 J.Serval and Essay (启发式合并)
Golang:go静态文件处理
LeetCode240+312+394
Centos install php7.4, build hyperf, forward RDS
Flink SQL - client, how to deal with the source side and to increase the target, the SQL - client including mapping table and the JOB such as
小程序通过云函数操作数据库【使用get取数据库】









![[Tear AHB-APB Bridge by hand]~ Why aren't the lower two bits of the AHB address bus used to represent the address?](/img/fb/c95c5857024db001638cd484c5e78f.png)