1、?Kanesong(?)?4?3?2?1?CONTENTS?4?3?2?1?CONTENTS?Pi?x?b?IMm?r?1.?4?3?2?1?CONTENTSh?i?fn?D?D?E?hVt?+?ek?c?-?D?BBEADb?+?B?A?E?BSg?+?A?B?v?(?BH?EA?D?P?sd?sao?sr?v?p?ECD?ED?D?-?EC?ED?/?D?BF?ED?C?D?D?N?StatefulSetPlus spec:batchDeployConfig:batchAuto:true batchIntervalMinutes:1 batchNum:2 maxFailed:10%pods
2、NumToUpdate:-30%-70%podManagementPolicy:Parallel replicas:6Kube-apiserverPodsPodsImage:V2Image:V1CompletedPodsImage:V21st batch deploy operation30%?pods2nd batch deploy operation70%?podsImage:V2After 1st batch successedCommit a auto batch Watch StatefulSetPlusUpdate eventStatefulSetPlus operatorBatc
3、h deploy controlP?E?A?D?D?A?D?AC?-?D?M?NodePodContainer image V1PodkubeletPatch a new image v2to Contianer1.Kubelet.syncPod find podtempletes hash changed2.Kill the Container3.Start a container with new imageContainer image V2StatefulsetPlus operator?-?D?M?StatefulsetPlus operatorCreate Podinject In
4、place Update readiness gate&Inplace Update Condition podtemplate.spec.containers:name:demo-container image:nginx:1.7.9readinessGates:-conditionType:InPlace-Updatestatus:conditions:-lastProbeTime:null status:True type:InPlace-Update containerStatuses:-image:nginx:1.7.9 name:demo-container ready:trueP
5、repare update PodUpdate podUpdated Pod completeUpdate Inplace Update Condition to FalsePatch new image to Pod templeteCheck containerstatus image equal pod templete image,update Inplace Update Condition to Truepodtemplate.spec.containers:name:demo-container image:nginx:1.7.9readinessGates:-condition
6、Type:InPlace-Updatestatus:conditions:-lastProbeTime:null status:“False”type:InPlace-Update containerStatuses:-image:nginx:1.7.9 name:demo-container ready:truepodtemplate.spec.containers:name:demo-container image:nginx:1.12readinessGates:-conditionType:InPlace-Updatestatus:conditions:-lastProbeTime:n
7、ull status:“False”type:InPlace-Update containerStatuses:-image:nginx:1.7.9 name:demo-container ready:truepodtemplate.spec.containers:name:demo-container image:nginx:1.12readinessGates:-conditionType:InPlace-Updatestatus:conditions:-lastProbeTime:null status:“True”type:InPlace-Update containerStatuse
8、s:-image:nginx:1.12 name:demo-container ready:trued?U?StatefulSetPlus spec:batchDeployConfig:?PodTemplate.spec.volumes:-configMap:name:app_cm_v2 name:cmvolumeKube-apiserverStatefulSetPlus-operatorPodsPodsConfigmap V1CompletedPodsIf inplace update,auto reload new configmap without restart podbatch de
9、ploy by manual/autoCommit a comfigmap volume update Watch StatefulSetPlusUpdate event?Batch 1Batch 2Kubelet VolumeManagerConfigmap V2Configmap V2Namespace:modelDerivedNameName:app_cm_v1Annotation:configmap-name:app_cm configmap-version:v1ConfigMapNamespace:modelDerivedNameName:app_cm_v2Annotation:co
10、nfigmap-name:app_cm configmap-version:v2ConfigMap?5?.?P?E?G?G?EB?G?F?%?D?A?h?i?fn?D?D?E?hVt?+?ek?c?-?D?BBEADb?+?B?A?E?BSg?+?A?B?gl?2?711?1?1?E?1?AA?2?1?1?1?E?1?AA?2?4?1?1?0?1?2?1?0?2?/?1?4?1?E?1?AA?1?E?1?AA?1?E?1?AA?1?2?1?/7?2?711?1?1?E?1?AA?1?E?1?AA?21?42/?4?21?42/?4?/?gl?T?S?StatefulSetPlus-Operat
11、orinit-containerbiz-sidecar?Podbiz-pauseinit-containerbiz-sidecar?Podbiz-container:v2init-containerbiz-sidecarbiz-pausePodbiz-container:v2EmptyDir Volumeversion1=1version2=1filelock.lcEmptyDir Volumeversion1=1version2=2filelock.lcEmptyDir Volumeversion1=2version2=2filelock.lc?filelock.lcversion1=1fi
12、lelock.lcversion2=1filelock.lcversion1=1filelock.lcversion2=2filelock.lcversion2=2filelock.lcversion1=2?1.?4?3?2?1?CONTENTS?d?a?V?d?a?Product 1 UsedProduct 2 UsedUnUsedProduct 3 PendingKube-Schedulerd?a?Dynamic Quota?P1 QuotaP2 QuotaPod UsedPod Used?P1 QuotaP2 QuotaPod UsedPod UsedUnused?P1 QuotaP2
13、QuotaPod UsedPod UsedUnusedTotalLeveld?a?Dynamic Quota?P1 QuotaP2 QuotaPod UsedPod Used?P1 QuotaP2 QuotaPod UsedPod Used?P1 QuotaP2 QuotaPod UsedPod UsedTotalLevel?EdDynamic Quotaunit:100 core?P1 QuotaOther QuotaUse 10?P1 QuotaOther QuotaUsed 25?P1 QuotaOther QuotaUse 15TotalLevelP1 add 100 quota100
14、*25/50=50100*15/50=30 100*10/50=20If total clusterRebalanced?a?:CA?C?1?C?1?D?:?E?1?C?1?1?EA?:?C?1?1?C?1?C?1?E?1?C?1?1?E?1?C?1?1:?1?:CA?C?1?C?1?C?1?C?1?E?1?C?1?1?E?1?C?1?1:?1?:CA?C?1?C?1?C?1?C?1?E?1?C?1?1?E?1?C?1?1:?1?1.?4?3?2?1?CONTENTS?c?K?Ru-?)?GD?C?DB?C)-?L?l?c?K%?E?BN?y?U-?%?ea?8?-?-?DeScheduler
15、?Real LoadPod3?Real LoadPod1Pod2Pod3Pod4?Real LoadPod4DeScheduler Rebalance?a?C?Dynamic Scheduler?Telegraf5mLoad1hLoad1dLoad?Telegraf5mLoad1hLoad1dLoadPrometheusnode-annotator?a?CDynamic Scheduler?5mLoadCPU50%1hLoadCPU30%Mem30%?5mLoadCPU50%1hLoadCPU40%Mem40%New Pod?5mLoadCPU50%1hLoad60%Mem60%(1-5m c
16、pu)*weight1+(1-1h cpu)*weight2+(1-Cur Mem)*weight3High ScoreDynamic Scheduler!#$%score=?1 x!)%!10score=x!=1?a?C?MUD?C?MULS?MUD?C?MULS?P?(Condition)?FDPressureepKdl?s?bT?QcWMl80%ThreadPressuretxnRur?bT?QcWMl90%CustomPIDPressuretxnR?r?bT?QcWMl90%KubeletProblemKubelet servicebTRunningDockerdProblemDocker servicebTRunningF?i?a?Containerd?P?o?False?ContainerdProblemContainerd servicebTRunningF?i?a?Docker?P?o?FalseStuckProcess?gtxIbTXVD?rOverlayDiskPressure?gtxqm?hbT?SkQ90%SerfFailedO?g?iy?N?1.?4?3?2?P?CONTENTS?EMU?F?5KI?1?