From 945345be0774af0f84e9852d844e3e54f19d251d Mon Sep 17 00:00:00 2001 From: DHARMIK GANGANI Date: Thu, 11 Jul 2024 04:45:17 -0300 Subject: [PATCH] Documentation for Debugging Snapshotter (#6859) * Documentation for Debugging Snapshotter * Documentation for Debugging Snapshotter * Documentation for Debugging Snapshotter --- .../debuggingsnapshot/README.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cluster-autoscaler/debuggingsnapshot/README.md diff --git a/cluster-autoscaler/debuggingsnapshot/README.md b/cluster-autoscaler/debuggingsnapshot/README.md new file mode 100644 index 000000000000..c6b17f90a6dd --- /dev/null +++ b/cluster-autoscaler/debuggingsnapshot/README.md @@ -0,0 +1,36 @@ +# Debugging Snapshotter +It's a tool to visualize the internal state of cluster-autoscaler at a point in time to help debug autoscaling issues. + +### Requirements +Require Cluster-autoscaler versions **1.24+** + +#### What data snapshotter can capture? +https://github.com/kubernetes/autoscaler/blob/8cf630a3e33ed3656cb4e669461bec197b77f2bb/cluster-autoscaler/debuggingsnapshot/debugging_snapshot.go#L60C1-L71C1 +```go +type DebuggingSnapshotImpl struct { + NodeList []*ClusterNode `json:"NodeList"` + UnscheduledPodsCanBeScheduled []*v1.Pod `json:"UnscheduledPodsCanBeScheduled"` + Error string `json:"Error,omitempty"` + StartTimestamp time.Time `json:"StartTimestamp"` + EndTimestamp time.Time `json:"EndTimestamp"` + TemplateNodes map[string]*ClusterNode `json:"TemplateNodes"` +} + +``` +## Development +Add the following flag to your cluster-autoscaler configuration to enable the snapshotter feature. +``` +--debugging-snapshot-enabled=true +``` +To access the sapshot from the command line, use the following command: +``` + curl http://127.0.0.1:8085/snapshotz > FIlE_NAME.json +``` +How to nevigate JSON file? + +```sh +cat FIlE_NAME.json | jq 'keys' +cat FIlE_NAME.json | jq '.NodeList | keys' //to see how many nodes are running +cat FIlE_NAME.json | jq '.TempletsNodes | keys' //to see templated nodes +cat FIlE_NAME.json | jq '.UnscheduledPodsCanBeScheduled | keys' //to see unscheduled pods that can be scheduled +```