@@ -684,6 +684,46 @@ type SwapStats struct {
684
684
}
685
685
```
686
686
687
+ In addition, we've added swap to stats to Summary API and Prometheus endpoints (` /stats/summary ` and
688
+ ` /metrics/resource ` ):
689
+ ``` shell
690
+ > kubectl get --raw " /api/v1/nodes/<NODE-NAME>/proxy/metrics/resource" | grep swap
691
+ # HELP container_swap_usage_bytes [ALPHA] Current container amount of swap usage in bytes
692
+ # TYPE container_swap_usage_bytes gauge
693
+ container_swap_usage_bytes{container=" c1" ,namespace=" default" ,pod=" test-pod" } 3.4400333824e+10 1687950863878
694
+ container_swap_usage_bytes{container=" coredns" ,namespace=" kube-system" ,pod=" coredns-8f5847b64-t9gmr" } 0 1687950855483
695
+ # HELP node_swap_usage_bytes [ALPHA] Current node swap usage in bytes
696
+ # TYPE node_swap_usage_bytes gauge
697
+ node_swap_usage_bytes 1.8446743709127774e+19 1687950863599
698
+ # HELP pod_swap_usage_bytes [ALPHA] Current pod amount of swap usage in bytes
699
+ # TYPE pod_swap_usage_bytes gauge
700
+ pod_swap_usage_bytes{namespace=" default" ,pod=" test-pod" } 3.4379333632e+10 1687950858784
701
+ pod_swap_usage_bytes{namespace=" kube-system" ,pod=" coredns-8f5847b64-t9gmr" } 0 1687950863144
702
+ ```
703
+
704
+ ``` shell
705
+ > kubectl get --raw " /api/v1/nodes/localhost/proxy/stats/summary"
706
+
707
+ node:
708
+ nodeName: localhost
709
+ swap:
710
+ swapAvailableBytes: 407531442176
711
+ swapUsageBytes: 18446743709127774000
712
+ pods:
713
+ - name: test-pod
714
+ swapUsageBytes: 34379333632
715
+ containers:
716
+ - name: c1
717
+ swapUsageBytes: 34400333824
718
+ - name: coredns-8f5847b64-t9gmr
719
+ swapUsageBytes: 0
720
+ containers:
721
+ - name: coredns
722
+ swapUsageBytes: 0
723
+ ```
724
+
725
+ (This output is simplified, for full examples please look at the description of: https://github.com/kubernetes/kubernetes/pull/118865 )
726
+
687
727
### Test Plan
688
728
689
729
<!--
0 commit comments