概要
openshift在有多個(gè)node節(jié)點(diǎn)時(shí)可以做到應(yīng)用的多活負(fù)載匀哄,并且在部分node節(jié)點(diǎn)丟失時(shí)保障應(yīng)用的高可用和自動(dòng)遷移至其他健康node節(jié)點(diǎn)。
測(cè)試
我在自己的環(huán)境上部署了一個(gè)應(yīng)用pod,當(dāng)我關(guān)閉pod所在node節(jié)點(diǎn)時(shí)飒硅,等待pod重新在其他健康的node節(jié)點(diǎn)上創(chuàng)建耗費(fèi)了很長(zhǎng)一段時(shí)間徒蟆,主要包括兩個(gè)時(shí)間:1、node丟失時(shí)間沟启。2忆家、pod驅(qū)逐重新調(diào)度時(shí)間。
node丟失時(shí)間
node丟失時(shí)間的設(shè)置參數(shù)為:node-monitor-grace-period德迹,默認(rèn)是40s芽卿,在40s內(nèi)判斷都是不健康就會(huì)把這個(gè)node標(biāo)記為不健康。
以下是配置文件的路徑和位置:
- /etc/origin/master/master-config.yaml
kubernetesMasterConfig:
controllerArguments:
node-monitor-grace-period:
- "40s"
- K8S官方解釋
Amount of time which we allow running Node to be unresponsive before marking it unhealthy. Must be N times more than kubelet's nodeStatusUpdateFrequency, where N means number of retries allowed for kubelet to post node status.
pod驅(qū)逐重新調(diào)度時(shí)間
在openshift判斷node節(jié)點(diǎn)丟失時(shí)胳搞,會(huì)判斷所在node節(jié)點(diǎn)的pod狀態(tài)信息卸例,如果在5分鐘內(nèi)都丟失的node節(jié)點(diǎn)沒(méi)有恢復(fù)健康称杨,就會(huì)把所在的pod給驅(qū)逐到其他健康的node節(jié)點(diǎn)上。
以下是配置文件的路徑和位置:
- /etc/origin/master/master-config.yaml
kubernetesMasterConfig:
podEvictionTimeout: 5m
- 官方解釋
Controls grace period for deleting pods on failed nodes. It takes valid time duration string. If empty, you get the default pod eviction timeout.
node上報(bào)自身狀態(tài)時(shí)間
node節(jié)點(diǎn)會(huì)上報(bào)自身狀態(tài)筷转,配置參數(shù)為:nodeStatusUpdateFrequency姑原,默認(rèn)10s。
- /etc/origin/node/node-config.yamlfile:
kubeletArguments:
node-status-update-frequency:
- "10s"
- 官方解釋
The node continues to report node status updates at the frequency specified by the node-status-update-frequency argument, which defaults to 10s (ten seconds).
重啟服務(wù)
在修改完配置文件后呜舒,要記得重啟相應(yīng)的master和node服務(wù)才能生效锭汛,如果是多節(jié)點(diǎn),要修改多個(gè)袭蝗。
參考鏈接
node-status-update-frequency
https://docs.openshift.com/container-platform/3.11/admin_guide/out_of_resource_handling.html#out-of-resource-eviction-thresholdsPodEvictionTimeout
https://docs.openshift.com/container-platform/3.11/install_config/master_node_configuration.html#node-config-pod-and-node-confignode-monitor-grace-period
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager
https://access.redhat.com/solutions/2899061