Monitoring resources per namespace

6/16/2019

I would like to monitor resources(CPU,Memory) on our kubernetes cluster per namespace and container, do you plan do add it directly into stackdriver or hiw can I do it without too much hassle? Thanks

I tried grouping metrics in stackdriver but its missing

-- surfmen
kubernetes

2 Answers

6/17/2019

look at kube resource explorer. it can list cpu and memory usage at namespace level. follow the link -->https://github.com/dpetzold/kube-resource-explorer

follow the below steps

master $ go get github.com/dpetzold/kube-resource-explorer/cmd/kube-resource-explorer

master $ /opt/go/bin/kube-resource-explorer -namespace kube-system -reverse -sort MemReq
Namespace    Name                                                    CpuReq      CpuReq%  CpuLimit  CpuLimit%  MemReq         MemReq%  MemLimit       MemLimit%
---------    ----                                                    ------      -------  --------  ---------  ------         -------  --------       ---------
kube-system  kube-scheduler-master/kube-scheduler                    100m        2%       0m        0%         0Mi            0%       0Mi            0%
kube-system  weave-net-4jb2j/weave                                   10m         0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  etcd-master/etcd                                        0m          0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  kube-apiserver-master/kube-apiserver                    250m        6%       0m        0%         0Mi            0%       0Mi            0%
kube-system  kube-controller-manager-master/kube-controller-manager  200m        5%       0m        0%         0Mi            0%       0Mi            0%
kube-system  kube-proxy-7275r/kube-proxy                             0m          0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  weave-net-4jb2j/weave-npc                               10m         0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  kube-proxy-jklzm/kube-proxy                             0m          0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  weave-net-s8zd8/weave                                   10m         0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  weave-net-s8zd8/weave-npc                               10m         0%       0m        0%         0Mi            0%       0Mi            0%
kube-system  coredns-78fcdf6894-fg9mv/coredns                        100m        2%       0m        0%         70Mi           3%       170Mi          8%
kube-system  coredns-78fcdf6894-mw6xc/coredns                        100m        2%       0m        0%         70Mi           3%       170Mi          8%
---------    ----                                                    ------      -------  --------  ---------  ------         -------  --------       ---------
Total                                                                790m/8000m  9%       0m/8000m  0%         140Mi/17515Mi  0%       340Mi/17515Mi  1%
master $
-- P Ekambaram
Source: StackOverflow

6/21/2019

You can use also prometheus you can find examples here and here

As per documentation

Prometheus is an optional monitoring tool often used with Kubernetes. If you configure Stackdriver Kubernetes Engine Monitoring with Prometheus support, then services that expose metrics in the Prometheus data model can be exported from the cluster and made visible as external metrics in Stackdriver

-- Hanx
Source: StackOverflow