当前位置:网站首页>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:
- 所有使用
kubectl
Commands issued are sent toapi-server
,The latter after receiving the writtenetcd
中. etcd
Write successfullyapi-server
Return to write the message of success,否则会返回错误信息.api-server
Notify the schedulerscheduler
把要创建的Pod分配到合适的节点上.scheduler
Choose 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.cpu
resources.limits.memory
Set the minimum resource requirements used by the container through the following two properties(下限),作为容器调度时资源分配的依据:
resources.requests.cpu
resources.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
边栏推荐
猜你喜欢
随机推荐
自制一款远程控制软件——VeryControl
zip打包目录所有文件(含隐藏文件/夹)
最新的Cesium和Three的整合方法(附完整代码)
三维坐标系距离
【HDLBits 刷题】Circuits(1)Combinational Logic
HoloView -- Tabular Datasets
pytest interface automation testing framework | parametrize source code analysis
小程序更多的手势事件(左右滑动、放大缩小、双击、长按)
22 Niu Ke Duo School 1 I. Chiitoitsu (Probability dp)
网络基础学习
Case practice --- Resnet classic convolutional neural network (Mindspore)
zip package all files in the directory (including hidden files/folders)
SAP ABAP ALV+SMARTFORS 表分页 报表打印程序
拳头游戏免版权音乐下载,英雄联盟无版权音乐,可用于视频创作、直播
Redis 3.2.3 crashed by signal: 11 服务宕机问题排查
XX市消防救援指挥中心实战指挥平台多链路聚合解决方案实例
Pytest | skip module interface test automation framework
22牛客多校1 I. Chiitoitsu (概率dp)
【Unity3D】相机
Fist game copyright-free music download, League of Legends copyright-free music, can be used for video creation, live broadcast