当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
小程序通过云函数操作数据库【使用get取数据库】
zip打包目录所有文件(含隐藏文件/夹)
关于App不同方式更新的测试点归纳
VoLTE基础学习系列 | 什么是SIP和IMS中的Forking
POJ2421道路建设题解
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
The use of Golang: go template engine
HoloView 在 jyputer lab/notebook 不显示总结
Golang:go模版引擎的使用
22牛客多校1 I. Chiitoitsu (概率dp)
套接字选项
VSCode插件推荐(Rust环境)
special day to remember
HoloView -- Tabular Datasets
pytest interface automation testing framework | pass in parameter values in the form of function return values
[Tear AHB-APB Bridge by hand]~ Why aren't the lower two bits of the AHB address bus used to represent the address?
Mysql database deployment and initialization steps
Golang:go获取url和表单属性值
22 Niu Ke Duo School 1 I. Chiitoitsu (Probability dp)
小程序更多的手势事件(左右滑动、放大缩小、双击、长按)








