Skip to content

OpenShift/Kubernetes Client

Resources

Different Pod details

List of Pods with resources

1
2
curl -O -L https://examples.openshift.pub/client/podlist-with-resources.gotemplate
oc get pods -n openshift-monitoring -o go-template-file=podlist-with-resources.gotemplate
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{{$printf_format := "%-50s\t%-50s\t%-50s\t%s\n" }}
{{- printf $printf_format "NAMESPACE" "POD NAME" "CONTAINER NAME" "RESOURCES" -}}
{{- range .items -}}
    {{- if eq .kind "Pod" -}}
            {{$namespace := .metadata.namespace -}}
            {{$pod_name := .metadata.name}}
        {{- range .spec.containers -}}
            {{$resources := "There are no resources."}}
            {{- if .resources -}}
                {{$resources = .resources }}
            {{- end -}}
            {{- printf $printf_format $namespace $pod_name .name $resources -}}
        {{- end -}}
    {{- end -}}
{{- end -}}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
NAMESPACE                                           POD NAME                                            CONTAINER NAME                                      RESOURCES
openshift-monitoring                                alertmanager-main-0                                 alertmanager                                        map[requests:map[cpu:4m memory:40Mi]]
openshift-monitoring                                alertmanager-main-0                                 config-reloader                                     map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                alertmanager-main-0                                 alertmanager-proxy                                  map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                alertmanager-main-0                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                alertmanager-main-0                                 prom-label-proxy                                    map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                alertmanager-main-1                                 alertmanager                                        map[requests:map[cpu:4m memory:40Mi]]
openshift-monitoring                                alertmanager-main-1                                 config-reloader                                     map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                alertmanager-main-1                                 alertmanager-proxy                                  map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                alertmanager-main-1                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                alertmanager-main-1                                 prom-label-proxy                                    map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                alertmanager-main-2                                 alertmanager                                        map[requests:map[cpu:4m memory:40Mi]]
openshift-monitoring                                alertmanager-main-2                                 config-reloader                                     map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                alertmanager-main-2                                 alertmanager-proxy                                  map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                alertmanager-main-2                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                alertmanager-main-2                                 prom-label-proxy                                    map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                cluster-monitoring-operator-75f69c8797-5427v        kube-rbac-proxy                                     map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                cluster-monitoring-operator-75f69c8797-5427v        cluster-monitoring-operator                         map[requests:map[cpu:10m memory:75Mi]]
openshift-monitoring                                grafana-6d68f8478f-fx2bp                            grafana                                             map[requests:map[cpu:4m memory:64Mi]]
openshift-monitoring                                grafana-6d68f8478f-fx2bp                            grafana-proxy                                       map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                kube-state-metrics-5f457b6bc7-59fsw                 kube-state-metrics                                  map[requests:map[cpu:2m memory:80Mi]]
openshift-monitoring                                kube-state-metrics-5f457b6bc7-59fsw                 kube-rbac-proxy-main                                map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                kube-state-metrics-5f457b6bc7-59fsw                 kube-rbac-proxy-self                                map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                node-exporter-5q2cs                                 node-exporter                                       map[requests:map[cpu:8m memory:32Mi]]
openshift-monitoring                                node-exporter-5q2cs                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                node-exporter-kz2rc                                 node-exporter                                       map[requests:map[cpu:8m memory:32Mi]]
openshift-monitoring                                node-exporter-kz2rc                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                node-exporter-s545f                                 node-exporter                                       map[requests:map[cpu:8m memory:32Mi]]
openshift-monitoring                                node-exporter-s545f                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                node-exporter-xdlqs                                 node-exporter                                       map[requests:map[cpu:8m memory:32Mi]]
openshift-monitoring                                node-exporter-xdlqs                                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                openshift-state-metrics-67cb99cb76-n9s2z            kube-rbac-proxy-main                                map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                openshift-state-metrics-67cb99cb76-n9s2z            kube-rbac-proxy-self                                map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                openshift-state-metrics-67cb99cb76-n9s2z            openshift-state-metrics                             map[requests:map[cpu:1m memory:32Mi]]
openshift-monitoring                                prometheus-adapter-55dd69754d-ff477                 prometheus-adapter                                  map[requests:map[cpu:1m memory:40Mi]]
openshift-monitoring                                prometheus-adapter-55dd69754d-kv8pd                 prometheus-adapter                                  map[requests:map[cpu:1m memory:40Mi]]
openshift-monitoring                                prometheus-k8s-0                                    prometheus                                          map[requests:map[cpu:70m memory:1Gi]]
openshift-monitoring                                prometheus-k8s-0                                    config-reloader                                     map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                prometheus-k8s-0                                    thanos-sidecar                                      map[requests:map[cpu:1m memory:25Mi]]
openshift-monitoring                                prometheus-k8s-0                                    prometheus-proxy                                    map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                prometheus-k8s-0                                    kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                prometheus-k8s-0                                    prom-label-proxy                                    map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                prometheus-k8s-0                                    kube-rbac-proxy-thanos                              map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                prometheus-k8s-1                                    prometheus                                          map[requests:map[cpu:70m memory:1Gi]]
openshift-monitoring                                prometheus-k8s-1                                    config-reloader                                     map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                prometheus-k8s-1                                    thanos-sidecar                                      map[requests:map[cpu:1m memory:25Mi]]
openshift-monitoring                                prometheus-k8s-1                                    prometheus-proxy                                    map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                prometheus-k8s-1                                    kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                prometheus-k8s-1                                    prom-label-proxy                                    map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                prometheus-k8s-1                                    kube-rbac-proxy-thanos                              map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                prometheus-operator-974874c6d-vn425                 prometheus-operator                                 map[requests:map[cpu:5m memory:150Mi]]
openshift-monitoring                                prometheus-operator-974874c6d-vn425                 kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                telemeter-client-56fb9b5d77-q5wpp                   telemeter-client                                    map[requests:map[cpu:1m memory:40Mi]]
openshift-monitoring                                telemeter-client-56fb9b5d77-q5wpp                   reload                                              map[requests:map[cpu:1m memory:10Mi]]
openshift-monitoring                                telemeter-client-56fb9b5d77-q5wpp                   kube-rbac-proxy                                     map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-gswsz                     thanos-query                                        map[requests:map[cpu:10m memory:12Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-gswsz                     oauth-proxy                                         map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-gswsz                     kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-gswsz                     prom-label-proxy                                    map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-gswsz                     kube-rbac-proxy-rules                               map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-zs6qf                     thanos-query                                        map[requests:map[cpu:10m memory:12Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-zs6qf                     oauth-proxy                                         map[requests:map[cpu:1m memory:20Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-zs6qf                     kube-rbac-proxy                                     map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-zs6qf                     prom-label-proxy                                    map[requests:map[cpu:1m memory:15Mi]]
openshift-monitoring                                thanos-querier-674d9c9bcd-zs6qf                     kube-rbac-proxy-rules                               map[requests:map[cpu:1m memory:15Mi]]

Last update: October 7, 2021
Back to top