Skip to content

Commit 592613d

Browse files
authored
docs(k8s): add command line to show resource usage by resource kind (#4797)
1 parent 53d4ad8 commit 592613d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pages/kubernetes/how-to/recover-space-etcd.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ This guide helps you to free up space on your database to avoid reaching this li
2222
- [Created](/kubernetes/how-to/create-cluster/) a Kubernetes Kapsule cluster
2323
- [Downloaded](/kubernetes/how-to/connect-cluster-kubectl/) the Kubeconfig
2424

25+
* Dump your cluster resources to YAML format and show the characters count, you will have a rough estimation where to look for space to claim
26+
27+
```sh
28+
> kubectl api-resources --verbs=list --namespaced -o name | while read type; do echo -n "Kind: ${type}, Size: "; kubectl get $type -o yaml -A | wc -c; done
29+
Kind: configmaps, Size: 1386841
30+
Kind: endpoints, Size: 82063
31+
Kind: events, Size: 375065
32+
Kind: limitranges, Size: 68
33+
Kind: persistentvolumeclaims, Size: 68
34+
Kind: pods, Size: 3326153
35+
[...]
36+
```
37+
2538
* Looking for unused resources is a good approach, delete any Secrets, large ConfigMaps that are not used anymore in your cluster.
2639

2740
```sh
@@ -51,4 +64,4 @@ Look for resources with an external apiversion (not _v1_, _apps/v1_, _storage.k8
5164
```sh
5265
> kubectl get nodefeature -n kube-system $node-feature-name -o yaml | wc -c
5366
305545 // ~300KiB, big object
54-
```
67+
```

0 commit comments

Comments
 (0)