Skip to content
Snippets Groups Projects
Commit 358c8477 authored by seph's avatar seph
Browse files

Resource config now in config.kubeStateMetrics

As requested, this updates the resource specification to live directly in config.kubeStateMetrics

It also clarifies the config variables. These names are what google uses in some of their tooling.

(And a slight tweak to the way collectors are specified)
parent b6e7d708
No related branches found
No related tags found
No related merge requests found
......@@ -369,24 +369,23 @@ The Prometheus `/targets` page will show the kubelet job with the error `403 Una
#### Authorization problem
The Prometheus `/targets` page will show the kubelet job with the error `401 Unauthorized`, when token authorization is not enabled. Ensure that the `--authorization-mode=Webhook` flag is enabled on all kubelet configurations.
### kube-state-metrics resource usaged
### kube-state-metrics resource usage
In some environments, kube-state-metrics may need additional
resources. One driver for more resource needs, is a high number of
namespaces. There may be others.
kube-state-metrics has it's resources using an
kube-state-metrics resource allocation is managed by
[addon-resizer](https://github.com/kubernetes/autoscaler/tree/master/addon-resizer/nanny)
You can control it's parameters by setting variables in the
config. They default to:
``` jsonnet
resizer+:: {
kubeStateMetrics+:: {
cpu: '100m',
extraCpu: '2m',
memory: '150Mi',
extraMemory: '30Mi',
},
kubeStateMetrics+:: {
baseCPU: '100m',
cpuPerNode: '2m',
baseMemory: '150Mi',
memoryPerNode: '30Mi',
}
```
......@@ -5,19 +5,14 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
namespace: 'default',
kubeStateMetrics+:: {
// when this is an empty string, you get the default set
collectors: '',
scrapeTimeout: '',
collectors: '', // empty string gets a default set
scrapeInterval: '30s',
},
scrapeTimeout: '',
resizer+:: {
kubeStateMetrics+:: {
cpu: '100m',
extraCpu: '2m',
memory: '150Mi',
extraMemory: '30Mi',
},
baseCPU: '100m',
baseMemory: '150Mi',
cpuPerNode: '2m',
memoryPerNode: '30Mi',
},
versions+:: {
......@@ -153,20 +148,19 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
'--port=8081',
'--telemetry-host=127.0.0.1',
'--telemetry-port=8082',
'--collectors=' + $._config.kubeStateMetrics.collectors,
]) +
container.mixin.resources.withRequests({ cpu: $._config.resizer.kubeStateMetrics.cpu, memory: $._config.resizer.kubeStateMetrics.memory }) +
container.mixin.resources.withLimits({ cpu: $._config.resizer.kubeStateMetrics.cpu, memory: $._config.resizer.kubeStateMetrics.memory });
] + if $._config.kubeStateMetrics.collectors != '' then ['--collectors=' + $._config.kubeStateMetrics.collectors] else []) +
container.mixin.resources.withRequests({ cpu: $._config.kubeStateMetrics.baseCPU, memory: $._config.kubeStateMetrics.baseMemory }) +
container.mixin.resources.withLimits({ cpu: $._config.kubeStateMetrics.baseCPU, memory: $._config.kubeStateMetrics.baseMemory });
local addonResizer =
container.new('addon-resizer', $._config.imageRepos.addonResizer + ':' + $._config.versions.addonResizer) +
container.withCommand([
'/pod_nanny',
'--container=kube-state-metrics',
'--cpu=' + $._config.resizer.kubeStateMetrics.cpu,
'--extra-cpu=' + $._config.resizer.kubeStateMetrics.extraCpu,
'--memory=' + $._config.resizer.kubeStateMetrics.memory,
'--extra-memory=' + $._config.resizer.kubeStateMetrics.extraMemory,
'--cpu=' + $._config.kubeStateMetrics.baseCPU,
'--extra-cpu=' + $._config.kubeStateMetrics.cpuPerNode,
'--memory=' + $._config.kubeStateMetrics.baseMemory,
'--extra-memory=' + $._config.kubeStateMetrics.memoryPerNode,
'--threshold=5',
'--deployment=kube-state-metrics',
]) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment