Pod 在滚动升级部署中部署pod个数到可用指标更新速率 是衡量 Kubenetes 调度能力最核心指标
举个例子:
rollingUpdate:
maxSurge: 25% #每个滚动更新的实例数量
maxUnavailable: 25% #允许更新过程中有多少实例不可用默认情况下,滚动升级是逐个更新的,当有几十上百个POD需要更新时,再加上、系统Admission Webhook、Scheduler Binding Score & filter、Probe就绪检测、整个过程Qps和Burst限制,整个过程将会更慢。
核心涉及几个步骤:
部署核心流程:
kubectl向apiserver发送部署请求(例如使用: kubectl create -f deployment.yml)apiserver将 Deployment 持久化到 etcd;etcd与apiserver进行一次http2.0通信。controller manager通过watch api监听 apiserver ,deployment controller看到了一个新创建的deplayment对象更后,将其从队列中拉出,根据deployment的描述创建一个ReplicaSet并将 ReplicaSet 对象返回apiserver并持久化回etcd。replicaset controller 看到新创建的replicaset对象,将其从队列中拉出,根据描述创建pod对象。scheduler调度器看到未调度的pod对象,根据调度规则选择一个可调度的节点,加载到pod描述中nodeName字段,并将pod对象返回apiserver并写入etcd。kubelet在看到有pod对象中nodeName字段属于本节点,将其从队列中拉出,通过容器运行时创建pod中描述的容器。组件之间通信是通过 http2.0 watch apiserver资源来获得,是实时长连接通知信息。基本上无可用加速点
kubelet 上报频次调整kubelet 上报频次, 让scheduler拿到较准确的Node资源拓扑信息, 用于更精准计算node权重
默认 kubelet 是通过
--node-status-update-frequency=10s #默认上报时间
--kube-api-qps=5
--kube-api-burst=10更改为
--node-status-update-frequency=3s
--kube-api-qps=50 #pod 部署后信息上报
--kube-api-burst=100 #pod 部署后信息上报controller manager 调整Node信息获取周期默认 controller manager 检查 kubelet 周期
--node-monitor-period=5s #检查 kubelet 的状态时间间隔
--node-monitor-grace-period=40s #检查 notready node 时间间隔
--pod-eviction-timeout=5m # pod 绑定失败后重新调度时间间隔更改为
--node-monitor-period=2s
--node-monitor-grace-period=20s
--pod-eviction-timeout=30swebhook 和 scheduler关闭链路中,不必要的自定义调度
kube-scheduler:
--feature-gates=CustomResourceValidationExpressions=false,...controller manager 并发度kube-controller-manager 进行调整:
--concurrent-deployment-syncs=5
--concurrent-endpoint-syncs=5
--concurrent-namespace-syncs=10
--concurrent-replicaset-syncs=5
--concurrent-service-syncs=10
--kube-api-qps=20
--kube-api-burst=30更改
--concurrent-deployment-syncs=50
--concurrent-endpoint-syncs=50
--concurrent-namespace-syncs=100
--concurrent-replicaset-syncs=50
--concurrent-service-syncs=100
--kube-api-qps=500
--kube-api-burst=100pod deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1000
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.15.4
resources:
limits:
cpu: "10m"
memory: 10Mi
requests:
cpu: "10m"
memory: 10Mi
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: nginx-pdb
spec:
maxUnavailable: 25%
minAvailable: 25%
selector:
matchLabels:
app: nginx1000个 pod 创建到ready状态,在以上配置后,耗时 从 78s->24s, 这个控制面Qps 高了10倍
资源拓扑感知调度优化下一个阶段:资源拓扑感知调度干预
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。