惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
V
V2EX
美团技术团队
H
Help Net Security
月光博客
月光博客
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
U
Unit 42
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - Franky
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
MyScale Blog
MyScale Blog
B
Blog
雷峰网
雷峰网
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
T
The Blog of Author Tim Ferriss

hwchiu learning note Blog

Kubernetes 怎麼計算 imageFS | hwchiu learning note Nginx Proxy_Pass 不會重新查詢 DNS | hwchiu learning note Multus 下如何透過 network policy 設定 | hwchiu learning note Linux Bridge MTU | hwchiu learning note Kubevirt 初體驗 | hwchiu learning note [MacOS ]隨手筆記 Sed 與 Rename 的使用 | hwchiu learning note Docusaurus 使用 blog mode 後連結一直反白的問題 | hwchiu learning note gcloud 切換帳號 | hwchiu learning note k8s 內安裝 redis-cluster | hwchiu learning note Helm Chart 中如何根據條件來動態安裝 Template 內的物件 | hwchiu learning note GCS 操作上注意事項 | hwchiu learning note istio 操作記錄 | hwchiu learning note terraform | hwchiu learning note Kubernetes GKE 維運上小筆記 | hwchiu learning note Git 修改 author/committer | hwchiu learning note GCP NAT 相關筆記 | hwchiu learning note gcloud ssh 到 GCP VM | hwchiu learning note CloudSQL 收費注意事項 | hwchiu learning note Loki 安裝上的參數調整以及 Ring 的問題除錯 | hwchiu learning note kustomize + helm | hwchiu learning note 觀測 K8s 內 OOM 事件 | hwchiu learning note GKE 上的 RBAC 筆記 | hwchiu learning note 本地產生 jwt token | hwchiu learning note ArgoCD 安裝筆記 | hwchiu learning note CircleCI Context 的使用 | hwchiu learning note 透過 GCP IAP Gateway 來保護 GKE 內的網站 | hwchiu learning note 閱讀筆記: 「SRE 的工作介绍」 | hwchiu learning note 閱讀筆記: 「DevOps is a failure」 | hwchiu learning note 閱讀筆記: 「面試人生 - 設計一個簡易的分散式 Job Scheduler」 | hwchiu learning note 閱讀筆記: 「Cloudflare 06/21 災後報告」 | hwchiu learning note
閱讀筆記: 「Kubernetes Resource Limit/Request 誤用造成的...
HungWei ChiuBlogger · 2021-12-06 · via hwchiu learning note Blog

連結: https://itnext.io/how-to-set-kubernetes-resource-requests-and-limits-a-saga-to-improve-cluster-stability-and-a7b1800ecff1

今天這篇文章探討的則是 resources 底下的 request/limit 問題。 本文作者之前遇到一個非常規律的服務警告問題,花了非常多時間與步驟去查詢,最後才發現是 Pod 裡面 Resource 的設定不夠嚴謹與完善。 舉例來說, resources: limit: cpu: 1000m request: cpu: 100m 今天假設有一個服務描述,我對 cpu 的最低要求是 0.1顆,但是極限是 1顆 且有一個節點本身有 3 顆 CPU,這種情況下,我們對該服務設定多副本運行(10個). 那根據 request 的要求,10個副本頂多只需要 1 顆 cpu,所以非常輕鬆的可以將 10 個服務運行起來,但是如何今天遇到尖峰流量 ,每個 pod 都瘋狂使用 CPU會發生什麼事情? 每個副本的極限都是 1 顆,因此 10 個副本就可以衝到 10 顆 CPU..而系統上只有 3顆,這就會造成 CPU 完全不夠使用,最後導致每個應用程式都在搶 CPU 使用,如果沒有特別設定相關的 nice 值來處理,可能會造 成關鍵 process 無法回應(案例中就是kubelet)。 這案例中 limit/request = 10x,作者認為這數字太大,它覺得合理的大概是 2x ~ 5x,並且最重要的是要定期去檢視系統上資源的用量, limit 要設定的合理,如果本身有很大量需求,建議還要搭配 node select, affinity/anti-affinity 讓每個 pod 最好找到適合的配置方式,然後也要避免尖峰流量到來時,系統資源被吃光甚至影響到 kubelet/kube-proxy 等底層服務的運作。