修復超過三個運算節點的叢集中的負載平衡器服務錯誤
摘要
在 CubeCOS 3.0.0 版本中,當叢集擁有超過三個運算節點時,負載平衡即服務(LBaaS)可能錯誤地將其標示為「不健康」。
詳細資訊
問題描述
Octavia 工作節點僅設計於前三個運算節點上運行。 然而,健康檢查程式會評估所有運算節點。 當檢查超過前三個的運算節點時,系統會偵測到這些節點上未運行Octavia,並錯誤地將負載平衡即服務 LBaaS 標記為 unhealthy 狀態。
適用版本
CubeCOS 3.0.0 及以上版本。
本文適用於運行 CubeCOS 3.0.0 或更新版本的環境。
決議
修補 LBaaS 狀態監控程式
-
開啟一個終端機工作階段。
-
請以
root使用者身分透過 SSH 登入您的叢集管理 VIP。ssh root@<your-cluster-vip> -
開啟健康監測設定檔以編輯負載平衡即服務 LBaaS 健康檢測。
SDK 健康模組為 CubeCOS 服務提供健康檢查與自動化修復動作。 此指令將透過檔案編輯器開啟健康監測器的設定檔。
vim /usr/lib/hex_sdk/modules/sdk_health.sh -
找到Octavia健康狀態檢測功能
- 輸入
/health_octavia_check()以搜尋health_octavia_check函式 - 按下
Enter鍵 - 當
health_octavia_check()函式被標示時,請檢視現有的邏輯。 您將修改此函式以防止虛假的 LBaaS 健康狀態錯誤。
- 輸入
-
更新計算節點檢查機制,使其僅驗證前三個計算節點上的 Octavia 服務。
-
在 health_octavia_check() 函式中,請將 Octavia 運算節點檢查包裹於以下條件中:
if remote_run $node hex_sdk is_first_three_compute_node ; then...fi
-
-
套用健康檢查的變更
-
定位設定錯誤記錄來源的行
ERR_LOG="ip addr show" -
找到緊接在這一行之後的
for迴圈for node in "${CUBE_NODE_COMPUTE_HOSTNAMES[@]}" ; do...done
-
-
請將條件邏輯加入此迴圈內,如下所示的差異:
health_octavia_check(){stale_api_check_repair octavia-api 9876 octavia-api python3local http_stats=$(influx -host $(shared_id) -database monasca -format json -execute "select last(value) from http_status where service = 'octavia'" | jq .results[0].series[0].values[0][1])if [ "$http_stats" != "0" ] ; thenERR_CODE=1elsefor node in "${CUBE_NODE_CONTROL_HOSTNAMES[@]}" ; doif ! is_remote_running $node octavia-api ; thenERR_MSG+="octavia-api on $node is not running\n"ERR_CODE=3ERR_LOG="journalctl -n $ERR_LOGSIZE -u octavia-api"elif ! is_remote_running $node octavia-housekeeping ; thenERR_MSG+="octavia-housekeeping on $node is not running\n"ERR_CODE=4ERR_LOG="journalctl -n $ERR_LOGSIZE -u octavia-housekeeping"fidoneERR_LOG="ip addr show"for node in "${CUBE_NODE_COMPUTE_HOSTNAMES[@]}" ; do+ if remote_run $node hex_sdk is_first_three_compute_node ; then+ if ! remote_run $node ovs-vsctl port-to-br octavia-hm0 >/dev/null 2>&1 ; then+ ERR_MSG+="no octavia-hm0 ovn port found on $node\n"+ ERR_CODE=5+ elif remote_run $node ip link show octavia-hm0 | grep -q DOWN ; then+ ERR_MSG+="no link octavia-hm0 found on $node\n"+ ERR_CODE=6+ elif ! remote_run $node route -n | grep -q octavia-hm0 ; then+ ERR_MSG+="no route from octavia-hm0 found on $node\n"+ ERR_CODE=7+ elif ! is_remote_running $node octavia-worker ; then+ ERR_MSG+="octavia-worker on $node is not running\n"+ ERR_CODE=8+ elif ! is_remote_running $node octavia-health-manager ; then+ ERR_MSG+="octavia-health-manager on $node is not running\n"+ ERR_CODE=9+ fi+ fi- if ! remote_run $node ovs-vsctl port-to-br octavia-hm0 >/dev/null 2>&1 ; then- ERR_MSG+="no octavia-hm0 ovn port found on $node\n"- ERR_CODE=5- elif remote_run $node ip link show octavia-hm0 | grep -q DOWN ; then- ERR_MSG+="no link octavia-hm0 found on $node\n"- ERR_CODE=6- elif ! remote_run $node route -n | grep -q octavia-hm0 ; then- ERR_MSG+="no route from octavia-hm0 found on $node\n"- ERR_CODE=7- elif ! is_remote_running $node octavia-worker ; then- ERR_MSG+="octavia-worker on $node is not running\n"- ERR_CODE=8- elif ! is_remote_running $node octavia-health-manager ; then- ERR_MSG+="octavia-health-manager on $node is not running\n"- ERR_CODE=9- fidonefi_health_fail_log} -
同步更新後的設定。
儲存檔案後,將更新後的健康模組同步至所有運算與控制融合節點:
cubectl node rsync /usr/lib/hex_sdk/modules/sdk_health.sh -r compute -
驗證健康檢查修復方案。
-
手動執行健康檢查:
hex_sdk health_octavia_check ; echo $? -
若指令返回
0,表示修復已完成。 無需重新啟動服務或重新開機節點。