DEV Community

terngr
terngr

Posted on

1

Reset pod's restart Count

สวัสดีครับ ในการ Monitoring K8s Cluster ตัวแปรสำคัญหนึ่งคือ restartCount ที่จะบอกเราว่า container มีการ restart ไปแล้วกี่ครั้ง
Alt Text

หรือสามารถเช็คได้จาก key statusCount: 17
Alt Text

การ restart มีความเป็นไปได้หลายสาเหตุครับ เช่น onFailure ในตัว container เอง, livenessProbe ไม่ผ่าน เพราะมีปัญหาที่ฝั่ง Network หรืออื่นๆ ได้หลายกรณี ฉะนั้นค่าที่ได้จาก restartCount จึงมีความสำคัญในการช่วย Investigate

ถ้าต้องการ reset ค่าของ restartCount เช่นทุกๆ 24 ชั่วโมง เพื่อที่จะ Monitor ได้ง่าย, หรือช่วยในการเก็บ Report จาก status ของวันนี้มี restartCount แล้วกี่ครั้ง

ปัจจุบัน ยังไม่สามารถ reset ค่า restartCount บน container ได้ครับ
สิ่งที่ทำได้ จะเป็นการ rollout restart เพื่อบังคับให้สร้าง container ใหม่ ค่า restartCount ก็จะเริ่มนับที่ 0 ใหม่โดยอัตโนมัติ

Alt Text

ทั้งนี้ ใน Community ก็ได้มีการร้องขอให้เพิ่มความสามารถ ในการ reset ค่า restartCount นี้อยู่ครับ คงต้องติดตามในอนาคตว่า Kubernetes จะเพิ่มความสามารถนี้เข้ามาไหม

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (1)

Collapse
 
terngr profile image
terngr

50375 เรื่อง reset sestartCount ครับ

github.com/kubernetes/kubernetes/i...

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs