Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Debugging Snapshotter #6859

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions cluster-autoscaler/debuggingsnapshot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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/master/cluster-autoscaler/debuggingsnapshot/debugging_snapshot.go#L60C1-L71C1
Dharma-09 marked this conversation as resolved.
Show resolved Hide resolved
```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
1. First step is enable the snapshotter adding the following flag to cluster-autoscaler [manifest](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/bizflycloud/manifest/cluster-autoscaler.yaml) .
Dharma-09 marked this conversation as resolved.
Show resolved Hide resolved

```
--debugging-snapshot-enabled=true
```
2. Save the updated manifest file and apply it to your Kubernetes cluster using:

```bash
kubectl apply -f <path-to-your-manifest-file>
```
3. once you deploy your pod make a snap shot request
```sh
curl http://127.0.0.1:8085/snapshotz > FIlE_NAME.json
```
Dharma-09 marked this conversation as resolved.
Show resolved Hide resolved

#### How to nevigate JSON file?

```sh
cat tmp.json | jq 'keys'
cat tmp.json | jq '.NodeList | keys' //to see how many nodes are running
cat tmp.json | jq '.TempletsNodes | keys' //to see templated nodes
cat tmp.json | jq '.UnscheduledPodsCanBeScheduled | keys' //to see unscheduled pods that can be scheduled
```
Loading