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
|
kubectl get --all-namespaces pods -o go-template='
{{ range .items -}}
{{- if eq .status.phase "Running" -}}
{{- $pod := .metadata.name -}}
{{- $ns := .metadata.namespace -}}
{{- range .spec.containers }}
{{- if or (not .resources) (not .resources.limits) (not .resources.limits.cpu) (not .resources.limits.memory) (not .resources.requests) (not .resources.requests.cpu) (not .resources.requests.memory) }}
NAMESPACE: {{ $ns }}
POD: {{ $pod }}
Container: {{ .name }}
{{- if not .resources }}
Problem: resources not set
{{- else -}}
{{- if not .resources.limits }}
Problem: resources.limits not set
{{- else if not .resources.limits.cpu }}
Problem: resources.limits.cpu not set
{{- else if not .resources.limits.memory }}
Problem: resources.limits.memory not set
{{- end -}}
{{- if not .resources.requests }}
Problem: resources.requests not set
{{- else if not .resources.requests.cpu }}
Problem: resources.requests.cpu not set
{{- else if not .resources.requests.memory }}
Problem: resources.requests.memory not set
{{- end -}}
{{- end }}
{{ end -}}
{{ end }}
{{- end -}}
{{ end }}'
|
评论